code: def document(self):
          
          if isinstance(self.media, types.MessageMediaDocument):
              if isinstance(self.media.document, types.Document):
                  return self.media.document
          else:
              web = self.web_preview
              if web and isinstance(web.photo, types.Document):
                  return web.photo
docs: If the message media is a document,
          this returns the :tl:`Document` object.