code: def _remove_extraneous_xml_declarations(xml_str):
          
          xml_declaration = ''
          if xml_str.startswith('<?xml'):
              xml_declaration, xml_str = xml_str.split('?>', maxsplit=1)
              xml_declaration += '?>'
          xml_str = re.sub(r'<\?xml.*?\?>', '', xml_str, flags=re.I)
          return xml_declaration + xml_str
docs: Sometimes devices return XML with more than one XML declaration in, such as when returning
          their own XML config files. This removes the extra ones and preserves the first one.