docstr: Write a file and set its access and modification times.
  
  Args:
    directory: Path to parent directory for the file, as a `str`.
    filename: Name of file inside directory, as a `str`.
    contents: File contents, as a `str`.
    utime: If not `None`, a 2-tuple of numbers (`int`s or `float`s)
      representing seconds since epoch for `atime` and `mtime`,
      respectively, as in the second argument to `os.utime`. Defaults
      to a fixed value; the file's timestamps will always be set.
  
  Returns:
    The new file path.
docstr_tok: ["Write","a","file","and","set","its","access","and","modification","times",".","Args",":","directory",":","Path","to","parent","directory","for","the","file",",","as","a","`","str","`",".","filename",":","Name","of","file","inside","directory",",","as","a","`","str","`",".","contents",":","File","contents",",","as","a","`","str","`",".","utime",":","If","not","`","None","`",",","a","2-tuple","of","numbers","(","`","int","`","s","or","`","float","`","s",")","representing","seconds","since","epoch","for","`","atime","`","and","`","mtime","`",",","respectively",",","as","in","the","second","argument","to","`","os.utime","`",".","Defaults","to","a","fixed","value",";","the","file","'s","timestamps","will","always","be","set",".","Returns",":","The","new","file","path","."]
code: def _write_file(self, directory, filename, contents, utime=None):
      """Write a file and set its access and modification times.
  
      Args:
        directory: Path to parent directory for the file, as a `str`.
        filename: Name of file inside directory, as a `str`.
        contents: File contents, as a `str`.
        utime: If not `None`, a 2-tuple of numbers (`int`s or `float`s)
          representing seconds since epoch for `atime` and `mtime`,
          respectively, as in the second argument to `os.utime`. Defaults
          to a fixed value; the file's timestamps will always be set.
  
      Returns:
        The new file path.
      """
      filepath = os.path.join(directory, filename)
      with open(filepath, "w") as outfile:
          outfile.write(contents)
      if utime is None:
          utime = (123, 456)
      os.utime(filepath, utime)
      return filepath
  
file_path: tensorboard/tensorboard/pip_package/deterministic_tar_gz_test.py
imports: import gzip
  import os
  import subprocess
  import tarfile
  from tensorboard import test
label_desc: Use image node_id 3 for calling the DeterministicTarGzTest obj's underlying member method code with example usage: obj._write_file(directory, filename, contents, utime) and returns: filepath