def to_unicode_optional_iterator(x):
    if isinstance(x, basestring):
        return to_unicode(x)

    try:
        l = list(x)
    except TypeError, e:
        assert 'is not iterable' in str(e)
        return x
    else:
        return [ to_unicode(e) for e in l ]
Raise TypeError if x is a str containing non-utf8 bytes or if x is
dataset/ETHPy150Open ibagrak/algae/gae/libs/oauth2/__init__.py/to_unicode_optional_iterator