code: def get_parent_id(element):
          
          if 'parent' in element.attrib:
              return element.attrib['parent']
          else:
              return element.getparent().attrib[add_ns('id')]
docs: returns the ID of the parent of the given element