code: def _add_script(tmp_dir, path, contents=""):
      script, *_ = tmp_dir.gen(path, contents.encode("utf-8"))
      if hasattr(tmp_dir, "scm"):
          tmp_dir.scm_add(path, commit=f"add {path}")
      return script.fs_path
  
label_desc: Use image node_id 1 for calling a global function with example usage: _add_script(tmp_dir, path, contents) and returns: script