code: def to_fp(self, file_pointer, comments=None):
          
  
          # saving formula's internal comments
          for c in self.comments:
              print(c, file=file_pointer)
  
          # saving externally specified comments
          if comments:
              for c in comments:
                  print(c, file=file_pointer)
  
          print('p cnf', self.nv, len(self.clauses), file=file_pointer)
  
          for cl in self.clauses:
              print(' '.join(str(l) for l in cl), '0', file=file_pointer)
docs: The method can be used to save a CNF formula into a file pointer.
              The file pointer is expected as an argument. Additionally,
              supplementary comment lines can be specified in the ``comments``
              parameter.
  
              :param fname: a file name where to store the formula.
              :param comments: additional comments to put in the file.
  
              :type fname: str
              :type comments: list(str)
  
              Example:
  
              .. code-block:: python
  
                  >>> from pysat.formula import CNF
                  >>> cnf = CNF()
                  ...
                  >>> # the formula is filled with a bunch of clauses
                  >>> with open('some-file.cnf', 'w') as fp:
                  ...     cnf.to_fp(fp)  # writing to the file pointer