'Write the KeePass database back to a KeePass2 compatible file.
:arg stream: A writeable file-like object or IO buffer.'

def write_to(self, stream):

    if (not (isinstance(stream, io.IOBase) or isinstance(stream, file))):
        raise TypeError('Stream    does    not    have    the    buffer    interface.')
    self._write_header(stream)
