def xml_attrib_nsmap(element):
    """Replace nsmap values with their key in element attributes.

    Parameters
    ----------
    element : lxml.etree._Element

    Returns
    -------
    out : dict
        element.attrib with the replaced nsmap.

    """

    d = {}
    for key, value in element.attrib.items():
        new_key = key
        for nskey, nsvalue in element.nsmap.items():
            new_key = new_key.replace('{' + nsvalue + '}', nskey + ':')
        d[new_key] = value
    return d