def METHOD_NAME(document: Document, stream: TextIO, validate: bool = True, drop_duplicates: bool = True):
    document = validate_and_deduplicate(document, validate, drop_duplicates)
    write_document(document, stream)