Write :class:`~ctfile.ctfile.CTfile` data into file. 

        :param filehandle: File-like object.
        :param str file_format: Format to use to write data: ``ctfile`` or ``json``.
        :return: None.
        :rtype: :py:obj:`None`.

def write(self, filehandle, file_format):
        """Write :class:`~ctfile.ctfile.CTfile` data into file. 

        :param filehandle: File-like object.
        :param str file_format: Format to use to write data: ``ctfile`` or ``json``.
        :return: None.
        :rtype: :py:obj:`None`.
        """
        try:
            filehandle.write(self.writestr(file_format=file_format))
        except IOError:
            raise IOError('"filehandle" parameter must be writable.')