code: def put(self, filename, encoding=None):
          
          from . import LocalFile
  
          if os.path.isdir(filename) and self.source is None:
              raise ValueError("Cannot write this object to "
                               "directory %s without an explicit filename." % filename)
  
          target = get_target_path(filename, self.source)
  
          if encoding is None:
              encoding = self.encoding
  
          if self._isbytes:
              kwargs = {'mode': 'wb'}
          else:
              kwargs = {'mode': 'w', 'encoding': encoding}
  
          with open(target, **kwargs) as outfile:
              outfile.write(self._contents)
  
          return LocalFile(target, encoded_with=encoding)
docs: Write the file to the given path
  
          Args:
              filename (str): path to write this file to
              encoding (str): file encoding (default: system default)
  
          Returns:
              LocalFile: reference to the copy of the file stored at ``filename``