def METHOD_NAME(element, use_id=True):
    # Check that element is a tag node
    if type(element) != bs4.element.Tag:
        raise ExtractXPathError(
            "%s is not a supported data type. "
            "Only tag nodes from the tag tree are accepted." % type(element)
        )
    # Starting node
    # Check id first
    if use_id and element.get("id") is not None:
        return "//*/" + element.name + '[@id="' + element.get("id") + '"]'
    xpath = check_previous_tags(element)
    # Parent Nodes
    for parent in element.parents:
        # End of XPath - exclude from string
        if parent.name == "[document]":
            break
        # Check id first
        if use_id and parent.get("id") is not None:
            return (
                "//*/" + parent.name + '[@id="' + parent.get("id") + '"]/' + xpath
            )  # noqa
        xpath = check_previous_tags(parent) + "/" + xpath
    xpath = "/" + xpath
    return xpath