def element_to_dict(elem):
    """Helper to convert XML element to dict
    with same nested structure where element
    id (without namespace) is the key.
    0,1,2... is added to keys in case there are
    duplicates

    :param elem: XML ET element to be converted
    :rtype: dict
    """
    result = dict()
    for index, child in enumerate(elem):
        name = child.tag.split("}").pop()
        if list(child):
            #  Next statement checks if there are duplicates in tag names inside of element
            #  In case there are - adds an index to the end to maintain uniqueness
            if len({element.tag.split("}").pop() for element in elem}) != len(elem):
                result.update({f"{name}{index}": element_to_dict(child)})
            else:
                result.update({f"{name}": element_to_dict(child)})
        else:
            result.update({name: child.text})
    return result