def METHOD_NAME(filename, content):
  if os.path.exists(filename):
    with open(filename, 'rt') as strm:
      orig_content = strm.read()
    if orig_content == content:
      return False
  dirpath = os.path.dirname(filename)
  if not os.path.isdir(dirpath):
    os.makedirs(dirpath)
  with open(filename, 'wt') as strm:
    strm.write(content)
    strm.flush()
  return True