Convert an iterator/generator to a tuple so that it can be iterated again.

    E.g., convert zip in PY3.

def cvt_iter(a):
    '''
    Convert an iterator/generator to a tuple so that it can be iterated again.

    E.g., convert zip in PY3.
    '''
    if a is None:
        return a

    if not isinstance(a, (tuple, list)):
        # convert iterator/generator to tuple
        a = tuple(a)
    return a