code: def store_hparams_to_dir(hparams, model_directory, tower_name):
      # Removing the "context" hparam. This hparam is added for tpu, by the tpu team
      # It is not compatible with the function "to_proto" used below.
      if tf.estimator.RunConfig().is_chief:
          copy_hparams = hp.HParams(**hparams.values())
          if hasattr(copy_hparams, "context"):
              copy_hparams.del_hparam("context")
          with tf.io.gfile.GFile(
              os.path.join(model_directory, tower_name), "w"
          ) as f:
              f.write(str(copy_hparams.to_proto()))
  
imports: import collections
  import os
  import string
  import time
  from absl import flags
  from absl import logging
  from model_search import block
  from model_search import block_builder
  from model_search import hparam
  from model_search import utils
  from model_search.proto import hparam_pb2
  from model_search.proto import phoenix_spec_pb2
  from model_search.proto import transfer_learning_spec_pb2
  import numpy
  import tensorflow.compat.v2
  import tf_slim
  from google.protobuf import text_format
label_desc: Use image node_id 4 for calling a global function with example usage: store_hparams_to_dir(hparams, model_directory, tower_name) without return types