:return: a tuple with the base of an XPATH followed by any format key or attribute reference

def get_xpath_tuple(xpath):
    """ :return: a tuple with the base of an XPATH followed by any format key or attribute reference """

    xroot = get_xpath_root(xpath)
    xattr = None

    if xroot != xpath:
        xattr = get_xpath_branch(xroot, xpath).strip('@')

    return (xroot, xattr)