'Instantiate the right tuple type for the given element types.'

@classmethod
def from_types(cls, tys, pyclass=None):

    homogenous = False
    if tys:
        first = tys[0]
        for ty in tys[1:]:
            if (ty != first):
                break
        else:
            homogenous = True
    if ((pyclass is not None) and (pyclass is not tuple)):
        assert issubclass(pyclass, tuple)
        if hasattr(pyclass, '_asdict'):
            if homogenous:
                return NamedUniTuple(first, len(tys), pyclass)
            else:
                return NamedTuple(tys, pyclass)
    if homogenous:
        return UniTuple(first, len(tys))
    else:
        return Tuple(tys)
