def string_io(data=None):  # cStringIO can't handle unicode
    '''
    Pass data through to stringIO module and return result
    '''
    try:
        return cStringIO(bytes(data))
    except (UnicodeEncodeError, __HOLE__):
        return StringIO(data)
dataset/ETHPy150Open saltstack/salt/salt/_compat.py/string_io