docs: def screenshot(path=None):
      """Capture the screen and save it as a png file.
  
      If path is None then the image will be placed in the current
      folder with the names:
      ``screenshot001.png, screenshot002.png, ...``
  
      Args:
          path (Optional[Text]): The file path to save the screenshot.
      """
      if not _rootinitialized:
          raise TDLError('Initialize first with tdl.init')
      if isinstance(path, str):
          _lib.TCOD_sys_save_screenshot(_encodeString(path))
      elif path is None: # save to screenshot001.png, screenshot002.png, ...
          filelist = _os.listdir('.')
          n = 1
          filename = 'screenshot%.3i.png' % n
          while filename in filelist:
              n += 1
              filename = 'screenshot%.3i.png' % n
          _lib.TCOD_sys_save_screenshot(_encodeString(filename))
      else: # assume file like obj
          #save to temp file and copy to file-like obj
          tmpname = _os.tempnam()
          _lib.TCOD_sys_save_screenshot(_encodeString(tmpname))
          with tmpname as tmpfile:
              path.write(tmpfile.read())
          _os.remove(tmpname)