You shouldn't concatinate statements. It makes it difficult to find errors.
This should work:
lpbdom_element = lpbdom_Doc.GetRootElement()
lpbdom_element = lpbdom_element.GetChildElement("Body", "s","http://schemas.xmlsoap.org/soap/envelope/")
lpbdom_element = lpbdom_element.GetChildElement("FoliosRestantesResponse","","http://tempuri.org/")
lpbdom_element = lpbdom_element.GetChildElement("FoliosRestantesResult","","http://tempuri.org/")
lpbdom_element = lpbdom_element.GetChildElement("codigo","a","http://schemas.datacontract.org/2004/07/ServiceSoap.UBL2._0.Response")
ls_value = lpbdom_element.gettext()
You had two bugs:
<FoliosRestantesResult> inherits the namespace from parent ("http://tempuri.org/")
<codio> needs namespace prefix "a".