def swapdict(dic, check_ambiguity=True):
    """Swap keys for values in a dictionary

    ::

        >>> d = {'a':1}
        >>> swapdict(d)
        {1:'a'}

    """
    if check_ambiguity:
        assert len(set(dic.keys())) == len(set(dic.values())
            ), 'values is not a set. ambiguities for keys.'
    return dict(zip(dic.values(), dic.keys()))
