def _reversedict(d):
    """
    Internal helper for generating reverse mappings; given a
    dictionary, returns a new dictionary with keys and values swapped.

    """
    return dict(list(zip(list(d.values()), list(d.keys()))))
Internal helper for generating reverse mappings; given a
    dictionary, returns a new dictionary with keys and values swapped.