Context manager for creating a temporary directory.

  Args:
    prefix: string, the prefix for the temporary directory.
    run_dir: string, the base directory location of the temporary directory.

  Yields:
    string, the temporary directory created.

def _CreateTempDir(prefix, run_dir=None):
  """Context manager for creating a temporary directory.

  Args:
    prefix: string, the prefix for the temporary directory.
    run_dir: string, the base directory location of the temporary directory.

  Yields:
    string, the temporary directory created.
  """
  temp_dir = tempfile.mkdtemp(prefix=prefix + '-', dir=run_dir)
  try:
    yield temp_dir
  finally:
    shutil.rmtree(temp_dir)