(self, i, key=None)
return ~Permutation([i[1] for i in ic])
Return the permutation needed to obtain ``i`` from the sorted
        elements of ``i``. If custom sorting is desired, a key can be given.

        Examples
        ========

        >>> from sympy.combinatorics import Permutation
        >>> Permutation.print_cyclic = True

        >>> Permutation.from_sequence('SymPy')
        Permutation(4)(0, 1, 3)
        >>> _(sorted("SymPy"))
        ['S', 'y', 'm', 'P', 'y']
        >>> Permutation.from_sequence('SymPy', key=lambda x: x.lower())
        Permutation(4)(0, 2)(1, 3)
Return the permutation needed to obtain ``i`` from the sorted
        elements of ``i``. If custom sorting is desired, a key can be given.
Return the permutation needed to obtain i from the sorted elements of i . If custom sorting is desired a key can be given .
def from_sequence(self, i, key=None):
        """Return the permutation needed to obtain ``i`` from the sorted
        elements of ``i``. If custom sorting is desired, a key can be given.

        Examples
        ========

        >>> from sympy.combinatorics import Permutation
        >>> Permutation.print_cyclic = True

        >>> Permutation.from_sequence('SymPy')
        Permutation(4)(0, 1, 3)
        >>> _(sorted("SymPy"))
        ['S', 'y', 'm', 'P', 'y']
        >>> Permutation.from_sequence('SymPy', key=lambda x: x.lower())
        Permutation(4)(0, 2)(1, 3)
        """
        ic = list(zip(i, list(range(len(i)))))
        if key:
            ic.sort(key=lambda x: key(x[0]))
        else:
            ic.sort()
        return ~Permutation([i[1] for i in ic])
def from_sequence ( self , i , key = None ) : ic = list ( zip ( i , list ( range ( len ( i ) ) ) ) ) if key : ic . sort ( key = lambda x : key ( x [ 0 ] ) ) else : ic . sort ( ) return ~ Permutation ( [ i [ 1 ] for i in ic ] )