code: def configure_job():
      """Construct jobSpec for ML Engine job."""
      # See documentation:
      # https://cloud.google.com/ml-engine/reference/rest/v1/projects.jobs#traininginput
      training_input = {
          "pythonModule": "tensor2tensor.bin.t2t_trainer",
          "args": flags_as_args(),
          "region": text_encoder.native_to_unicode(default_region()),
          "runtimeVersion": RUNTIME_VERSION,
          "pythonVersion": "3.5"
          if sys.version_info.major == 3
          else "2.7",
          "jobDir": FLAGS.output_dir,
          "scaleTier": "CUSTOM",
          "masterType": FLAGS.cloud_mlengine_master_type
          or get_default_master_type(num_gpus=FLAGS.worker_gpu),
      }
      if FLAGS.use_tpu:
          training_input["masterType"] = (
              FLAGS.cloud_mlengine_master_type or "standard"
          )
          training_input["workerType"] = "cloud_tpu"
          training_input["workerCount"] = 1
      if FLAGS.hparams_range:
          tf.logging.info("Configuring hyperparameter tuning.")
          training_input["hyperparameters"] = configure_autotune(
              FLAGS.hparams_range,
              FLAGS.autotune_objective,
              FLAGS.autotune_maximize,
              FLAGS.autotune_max_trials,
              FLAGS.autotune_parallel_trials,
          )
  
      timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
      job_spec = {
          "jobId": "%s_%s_t2t_%s"
          % (FLAGS.model, FLAGS.problem, timestamp),
          "labels": {
              "model": FLAGS.model,
              "problem": FLAGS.problem,
              "hparams": FLAGS.hparams_set,
          },
          "trainingInput": training_input,
      }
      return job_spec
  
imports: import datetime
  import os
  import pprint
  import shutil
  import subprocess
  import sys
  import tempfile
  from googleapiclient import discovery
  from oauth2client.client import GoogleCredentials
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import usr_dir
  import tensorflow.compat.v1
label_desc: Use image node_id 11 for calling a global function with example usage: configure_job() and returns: job_spec