def getInv(wmap):

    """
    Get the inverse map of a dictionary.

    :param wmap: Dictionary

    :returns: Dictionary which is an inverse of the input dictionary
    """

    inv_map = {}
    for k, v in wmap.items():
        inv_map[v] = inv_map.get(v, [])
        inv_map[v].append(k)

    return inv_map