def equalize_perms(l):
    """
    Extend the permutations in ``l`` to have the same lengths.

    EXAMPLES::

        sage: from surface_dynamics.misc.permutation import equalize_perms
        sage: li = [[0, 1], [2, 1, 0]]
        sage: equalize_perms(li)
        3
    """
    n = max(map(len, l))
    for p in l:
        p.extend(range(len(p), n))
    return n
