'Get a root of a composite polynomial by index.'

@classmethod
def _indexed_root(cls, poly, index):

    (_, factors) = poly.factor_list()
    reals = cls._get_reals(factors)
    reals_count = cls._count_roots(reals)
    if (index < reals_count):
        reals = cls._reals_sorted(reals)
        return cls._reals_index(reals, index)
    else:
        complexes = cls._get_complexes(factors)
        complexes = cls._complexes_sorted(complexes)
        return cls._complexes_index(complexes, (index - reals_count))
