def METHOD_NAME(filename, is_config_cuda, is_config_rocm, key_value_list):
  """Writes a Python that describes the build.
  Args:
    filename: filename to write to.
    is_config_cuda: Whether this build is using CUDA.
    is_config_rocm: Whether this build is using ROCm.
    key_value_list: A list of "key=value" strings that will be added to the
      module as additional fields.
  Raises:
    ValueError: If `key_value_list` includes the key "is_cuda_build", which
      would clash with one of the default fields.
  """
  module_docstring = "\"\"\"Generates a Python module containing information "
  module_docstring += "about the build.\"\"\""
  build_config_rocm_bool = "False"
  build_config_cuda_bool = "False"
  if is_config_rocm == "True":
    build_config_rocm_bool = "True"
  elif is_config_cuda == "True":
    build_config_cuda_bool = "True"
  key_value_pair_stmts = []
  if key_value_list:
    for arg in key_value_list:
      key, value = arg.split("=")
      if key == "is_cuda_build":
        raise ValueError("The key \"is_cuda_build\" cannot be passed as one of "
                         "the --key_value arguments.")
      if key == "is_rocm_build":
        raise ValueError("The key \"is_rocm_build\" cannot be passed as one of "
                         "the --key_value arguments.")
      key_value_pair_stmts.append("%s = %r" % (key, value))
  key_value_pair_content = "\n".join(key_value_pair_stmts)
  contents = """