'Write the `HDUList` to a new file.
Parameters
fileobj : file path, file object or file-like object
File to write to.  If a file object, must be opened in a
writeable mode.
output_verify : str
Output verification option.  Must be one of ``"fix"``,
``"silentfix"``, ``"ignore"``, ``"warn"``, or
``"exception"``.  May also be any combination of ``"fix"`` or
``"silentfix"`` with ``"+ignore"``, ``+warn``, or ``+exception"
(e.g. ``"fix+warn"``).  See :ref:`verify` for more info.
overwrite : bool, optional
If ``True``, overwrite the output file if it exists. Raises an
``OSError`` (``IOError`` for Python 2) if ``False`` and the
output file exists. Default is ``False``.
.. versionchanged:: 1.3
``overwrite`` replaces the deprecated ``clobber`` argument.
checksum : bool
When `True` adds both ``DATASUM`` and ``CHECKSUM`` cards
to the headers of all HDU\'s written to the file.'

@deprecated_renamed_argument('clobber', 'overwrite', '2.0')
def writeto(self, fileobj, output_verify='exception', overwrite=False, checksum=False):

    if (len(self) == 0):
        warnings.warn('There    is    nothing    to    write.', AstropyUserWarning)
        return
    self.verify(option=output_verify)
    self.update_extend()
    closed = (isinstance(fileobj, string_types) or fileobj_closed(fileobj))
    fileobj = _File(fileobj, mode='ostream', overwrite=overwrite)
    hdulist = self.fromfile(fileobj)
    try:
        dirname = os.path.dirname(hdulist._file.name)
    except AttributeError:
        dirname = None
    with _free_space_check(self, dirname=dirname):
        for hdu in self:
            hdu._prewriteto(checksum=checksum)
            hdu._writeto(hdulist._file)
            hdu._postwriteto()
    hdulist.close(output_verify=output_verify, closed=closed)
