code: def elem2json(elem, options, strip_ns=1, strip=1):
  
      
  
      if hasattr(elem, 'getroot'):
          elem = elem.getroot()
  
      if options.pretty:
          return json.dumps(elem_to_internal(elem, strip_ns=strip_ns, strip=strip), sort_keys=True, indent=4, separators=(',', ': '))
      else:
          return json.dumps(elem_to_internal(elem, strip_ns=strip_ns, strip=strip))
docs: Convert an ElementTree or Element into a JSON string.