code: def write(self, session, directory, name, replaceParamFile=None, **kwargs):
          
  
          # Assemble Path to file
          name_split = name.split('.')
          name = name_split[0]
  
          # Default extension
          extension = ''
  
          if len(name_split) >= 2:
              extension = name_split[-1]
  
          # Run name preprocessor method if present
          try:
              name = self._namePreprocessor(name)
          except:
              'DO NOTHING'
  
          if extension == '':
              filename = '{0}.{1}'.format(name, self.fileExtension)
          else:
              filename = '{0}.{1}'.format(name, extension)
  
          filePath = os.path.join(directory, filename)
  
          with io_open(filePath, 'w') as openFile:
              # Write Lines
              self._write(session=session,
                          openFile=openFile,
                          replaceParamFile=replaceParamFile,
                          **kwargs)
docs: Write from database back to file.
  
          Args:
              session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database.
              directory (str): Directory where the file will be written.
              name (str): The name of the file that will be created (including the file extension is optional).
              replaceParamFile (:class:`gsshapy.orm.ReplaceParamFile`, optional): ReplaceParamFile instance. Use this if
                  the file you are writing contains replacement parameters.