docs: def string_to_element(element_as_string, include_namespaces=False):
      """ :return: an element parsed from a string value, or the element as is if already parsed """
  
      if element_as_string is None:
          return None
      elif isinstance(element_as_string, ElementTree):
          return element_as_string.getroot()
      elif isinstance(element_as_string, ElementType):
          return element_as_string
      else:
          element_as_string = _xml_content_to_string(element_as_string)
  
      if not isinstance(element_as_string, string_types):
          # Let cElementTree handle the error
          return fromstring(element_as_string)
      elif not strip_xml_declaration(element_as_string):
          # Same as ElementTree().getroot()
          return None
      elif include_namespaces:
          return fromstring(element_as_string)
      else:
          return fromstring(strip_namespaces(element_as_string))