def to_string(s):
    """Convert ``bytes`` to ``str``, leaving ``unicode`` unchanged.

    (This means on Python 2, ``to_string()`` does nothing.)

    Use this if you need to ``print()`` or log bytes of an unknown encoding,
    or to parse strings out of bytes of unknown encoding (e.g. a log file).
    """
    if not isinstance(s, string_types + (bytes,)):
        raise TypeError

    if PY2 or isinstance(s, str):
        return s

    try:
        return s.decode('utf_8')
    except __HOLE__:
        return s.decode('latin_1')
dataset/ETHPy150Open Yelp/mrjob/mrjob/py2.py/to_string