code: def write(path, data, binary=False):
      
      mode = "w"
      if binary:
          mode = "wb"
      with open(path, mode) as f:
          f.write(data)
      f.close()
docs: Writes a given data to a file located at the given path.