docs: def write(s, path, encoding="utf-8"):
      """Write string to text file.
      """
      is_gzip = is_gzip_file(path)
  
      with open(path, "wb") as f:
          if is_gzip:
              f.write(zlib.compress(s.encode(encoding)))
          else:
              f.write(s.encode(encoding))