code: def tag_from_element(el):
      
      tag = el.tag
      namespace = None
      if tag.startswith('{'):
          # Strip namespace of the form "{namespace}tag"
          namespace,tag = tag[1:].split('}')
      try:
          cls = globals()[tag.title()]
          if not issubclass(cls, TagBase):
              raise KeyError()
      except KeyError:
          raise ValueError("TagBase doesn't have a subclass for '%s'." % tag)
      children = [tag_from_element(c) for c in el]
      tag = cls(*children, **el.attrib)
      tag.text = el.text
      tag.tail = el.tail
      if namespace:
          tag.attrib['xmlns'] = namespace
      return tag
docs: Convert an Element into a Tag.
  
      ``el`` is an instance of ``Element``. Returns an instance of the
      corresponding subclass of ``TagBase``.