def to_fp(self, file_pointer, comments=None):
        """
            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 CNFPlus
                >>> cnf = CNFPlus()
                ...
                >>> # 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
        """

        # 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)

        ftype = 'cnf+' if self.atmosts else 'cnf'
        print('p', ftype, self.nv, len(self.clauses) + len(self.atmosts),
                file=file_pointer)

        for cl in self.clauses:
            print(' '.join(str(l) for l in cl), '0', file=file_pointer)

        for am in self.atmosts:
            print(' '.join(str(l) for l in am[0]), '<=', am[1], file=file_pointer)