def _find_transpose_compliment(perm):
        """
        return the permutation value that when applied will reverse the
        effect of the given permutation.

        e.g.: if perm == (1, 2, 3, 0), then return (3, 0, 1, 2), which will undo the
        first permutation's effect
        """
        rank = len(perm)
        all_positive_perm = [p + rank if p < 0 else p for p in perm]
        perm_inverse = [0] * rank
        for i in range(rank):
            perm_inverse[i] = all_positive_perm.index(i)
        return perm_inverse

        return the permutation value that when applied will reverse the
        effect of the given permutation.

        e.g.: if perm == (1, 2, 3, 0), then return (3, 0, 1, 2), which will undo the
        first permutation's effect
        
coremltools/converters/mil/mil/passes/defs/optimize_repeat_ops.py