code: def wrap_as_stream(item):
      
      if not PY3:
          return StringIO(item)
      if isinstance(item, str):
          return StringIO(item)
      elif isinstance(item, bytes):
          return BytesIO(item)
      raise ValueError('{} is not wrappable!'.format(type(item).__name__))
docs: Wrap a string or bytes object as a file object.
  
      Parameters
      ----------
      item: str or bytes
        Item to be wrapped
  
      Returns
      ---------
      wrapped: file-like object