code: def dumps(obj, root_tag):
      
      xml = _get_xml_value(obj)
      if xml:
          # Remove invalid XML
          xml = RE_ILLEGAL_XML.sub('', xml)
      if root_tag is None:
          return xml
      else:
          root = root_tag
          return '<' + root + '>' + xml + '</' + root + '>'
docs: Serialize :arg:`obj` to an XML :class:`str`.