def _bti_open(fname, *args, **kwargs):
 if isinstance(fname, six.string_types):
  return open(fname, *args, **kwargs)
 elif isinstance(fname, six.BytesIO):
  return _bytes_io_mock_context(fname)
 else:
  raise RuntimeError('Cannot mock this.')

def _bti_open ( fname , * args , ** kwargs ) : if isinstance ( fname , six . string_types ) : return open ( fname , * args , ** kwargs ) elif isinstance ( fname , six . BytesIO ) : return _bytes_io_mock_context ( fname ) else : raise RuntimeError ( 'Cannot mock this.' )
handle bytesio .