def METHOD_NAME(perm):
    """
    Function generating inverse of the permutation
    Parameters
    ----------
    perm : 1D array
    Returns
    -------
    inverse : 1D array
        permutation inverse of the input
    """
    inverse = [0] * len(perm)
    for i, p in enumerate(perm):
        inverse[p] = i
    return inverse