'Calculates the permutation from the inversion vector.
Examples
>>> from sympy.combinatorics.permutations import Permutation
>>> Permutation.print_cyclic = False
>>> Permutation.from_inversion_vector([3, 2, 1, 0, 0])
Permutation([3, 2, 1, 0, 4, 5])'

@classmethod
def from_inversion_vector(cls, inversion):

    size = len(inversion)
    N = list(range((size + 1)))
    perm = []
    try:
        for k in range(size):
            val = N[inversion[k]]
            perm.append(val)
            N.remove(val)
    except IndexError:
        raise ValueError('The    inversion    vector    is    not    valid.')
    perm.extend(N)
    return cls._af_new(perm)
