Convert :class:`~ctfile.ctfile.CTfile` into `CTfile` formatted string.

        :return: `CTfile` formatted string.
        :rtype: :py:class:`str`.

def _to_ctfile(self):
        """Convert :class:`~ctfile.ctfile.CTfile` into `CTfile` formatted string.

        :return: `CTfile` formatted string.
        :rtype: :py:class:`str`.
        """
        output = io.StringIO()
        for key in self:
            if key == 'CtabCountsLine':
                output.write(self._to_ctfile_counts_line(key=key))

            elif key == 'CtabAtomBlock':
                output.write(self._to_ctfile_atom_block(key=key))

            elif key == 'CtabBondBlock':
                output.write(self._to_ctfile_bond_block(key=key))

            else:
                raise KeyError('Ctab object does not supposed to have any other information: "{}".'.format(key))

        output.write(self._to_ctfile_property_block())
        output.write(self.ctab_conf[self.version]['END']['fmt'])
        output.write('\n')

        return output.getvalue()