':param output: Either an opened, file like object, or a path to the
desired output file. In the latter case, the file is created
and clients should use :py:meth:`close` method to close it.
:param write_empty: Whether to write empty elements and attributes.'

def __init__(self, output, write_empty=True):

    if is_string(output):
        output = file_writer(output)
    self.output = output
    self._write_empty = write_empty
    self._preamble()
