def sortRoots(roots):
    """Return a new list of roots sorted first on the real part then the imag.
    """
    lst = []
    for i, r in enumerate(roots):
        try:
            lst.append((r.real, r.imag, i, r))
        except AttributeError:
            lst.append((r, 0, i, r))
    lst.sort()
    return [r[-1] for r in lst]
