code: def asksaveasfile(mode="w", **options):
      "Ask for a filename to save as, and returned the opened file"
  
      filename = asksaveasfilename(**options)
      if filename:
          return open(filename, mode)
      return Nonf asksaveasfile(mode="w", **options):
      "Ask for a filename to save as, and returned the opened file"
  
      filename = asksaveasfilename(**options)
      if filename:
          return open(filename, mode)
      return None
docs: Ask for a filename to save as, and returned the opened file