code: def to_file(self, filename):
          
  
          img = self.to_image()
          img.save(filename, optimize=True)
          return self
docs: Export to image file.
  
          Parameters
          ----------
          filename : string
              Location to write to.
  
          Returns
          -------
          self