code: def download_context_directory(
      sess: api.Session, info: det.ClusterInfo
  ) -> None:
      b64_tgz = bindings.get_GetTaskContextDirectory(
          sess, taskId=info.task_id
      ).b64Tgz
      if len(b64_tgz) == 0:
          return  # Non trials can have empty model defs.
  
      tgz = base64.b64decode(b64_tgz)
      with tarfile.open(
          fileobj=io.BytesIO(tgz), mode="r:gz"
      ) as context_directory:
          # Ensure all members of the tarball resolve to subdirectories.
          for path in context_directory.getnames():
              if os.path.relpath(path).startswith("../"):
                  raise ValueError(
                      f"'{path}' in tarball would expand to a parent directory"
                  )
          context_directory.extractall(
              path=constants.MANAGED_TRAINING_MODEL_COPY
          )
          context_directory.extractall(path=".")
  
      # pre-0.18.3 code wrote tensorboard stuff under /tmp/tensorboard
      if is_trial(info):
          det.util.force_create_symlink(
              f"/tmp/tensorboard-{info.allocation_id}-0",
              "/tmp/tensorboard",
          )
  
imports: import argparse
  import base64
  import io
  import json
  import logging
  import os
  import socket
  import tarfile
  import uuid
  import warnings
  from typing import List, Optional
  import psutil
  import urllib3
  import determined
  import determined.util
  from determined import constants, gpu
  from determined.common import api, util
  from determined.common.api import bindings, certs
label_desc: Use image node_id 2 for calling a global function with example usage: download_context_directory(sess, info) without return types