code: def make_unistream(stream):
      '''Make a stream which unescapes string literals before writes out.'''
  
      unistream = lambda: 'I am an unistream!'
  
      # make unistream look like the stream
      for attr_name in dir(stream):
          if not attr_name.startswith('_'):
              setattr(unistream, attr_name, getattr(stream, attr_name))
  
      # modify the write method to unescape the output
      unistream.write = lambda b: stream.write(
          # TODO: the to_bytes makes the behavior different, should we care?
          unescape(to_bytes(b, unistream.encoding), unistream.encoding)
      )
  
      return unistreaf make_unistream(stream):
      '''Make a stream which unescapes string literals before writes out.'''
  
      unistream = lambda: 'I am an unistream!'
  
      # make unistream look like the stream
      for attr_name in dir(stream):
          if not attr_name.startswith('_'):
              setattr(unistream, attr_name, getattr(stream, attr_name))
  
      # modify the write method to unescape the output
      unistream.write = lambda b: stream.write(
          # TODO: the to_bytes makes the behavior different, should we care?
          unescape(to_bytes(b, unistream.encoding), unistream.encoding)
      )
  
      return unistream
docs: Make a stream which unescapes string literals before writes out.