code: def write(self, garbage=0, clean=0, deflate=0, ascii=0, expand=0, linear=0, pretty=0, decrypt=1):
          
  
          if self.isClosed or self.isEncrypted:
              raise ValueError("operation illegal for closed / encrypted doc")
          if self.pageCount < 1:
              raise ValueError("cannot write with zero pages")
  
  
          return _fitz.Document_write(self, garbage, clean, deflate, ascii, expand, linear, pretty, decrypt)
docs: Write document to a bytes object.