def _nsort(roots, separated=False):
    if not all(r.is_number for r in roots):
        raise NotImplementedError
    # see issue 6137:
    # get the real part of the evaluated real and imaginary parts of each root
    key = [[i.n(2).as_real_imag()[0] for i in r.as_real_imag()] for r in roots]
    # make sure the parts were computed with precision
    if any(i._prec == 1 for k in key for i in k):
        raise NotImplementedError("could not compute root with precision")
    # insert a key to indicate if the root has an imaginary part
    key = [(1 if i else 0, r, i) for r, i in key]
    key = sorted(zip(key, roots))
    # return the real and imaginary roots separately if desired
    if separated:
        r = []
        i = []
        for (im, _, _), v in key:
            if im:
                i.append(v)
            else:
                r.append(v)
        return r, i
    _, roots = zip(*key)
    return list(roots)
Validate input according to some JSON-schema file,
dataset/ETHPy150Open sympy/sympy/sympy/polys/polyutils.py/_nsort--crossover with--dataset/ETHPy150Open gengo/decanter/decanter/lib/decorator.py/validate_schema