code: def write_file(filename, string):
      
      import sys
      #ugly fix, hopefully we can find a better one
      if sys.version_info[0] >= 3:
          with open(filename, 'w', encoding="utf-8") as f:
              f.write(string)
      else:
          with open(filename, 'w') as f:
              f.write(string.encode("utf-8"))
docs: dump the contents of string to a file called filename