def inverted_dict(dict1):
    """" Performs key <-> value inversion in the dictionary

    Parameters
    ----------
    dict1 : dict

    Returns
    -------
    dict2 : dict
            Dictionary with inverted key-values.

    Examples
    --------
    dict1 = dict(a=1,b=2,c=3,d=4)
    inverted_dict(dict1) # result in {1: 'a', 2: 'b', 3: 'c', 4: 'd'}
                           (up to possible permutation of the elements)

    """

    dict2 = {v: k for k, v in dict1.items()}

    return dict2