docs: def to_fp(self, file_pointer, comments=None):
          """
              The method can be used to save a WCNF 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 WCNF
                  >>> wcnf = WCNF()
                  ...
                  >>> # the formula is filled with a bunch of clauses
                  >>> with open('some-file.wcnf', 'w') as fp:
                  ...     wcnf.to_fp(fp)  # writing to the file pointer
          """
  
          # 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 wcnf', self.nv, len(self.hard) + len(self.soft), self.topw, file=file_pointer)
  
          # soft clauses are dumped first because
          # some tools (e.g. LBX) cannot count them properly
          for i, cl in enumerate(self.soft):
              print(self.wght[i], ' '.join(str(l) for l in cl), '0', file=file_pointer)
  
          for cl in self.hard:
              print(self.topw, ' '.join(str(l) for l in cl), '0', file=file_pointer)