code: def adapt_old_configs(
      hparams: ml_collections.ConfigDict,
  ) -> ml_collections.ConfigDict:
      """Updates old configs with new namings."""
      with hparams.unlocked():
          # Make sure attention_config exists.
          attention_config = hparams.model.get("attention_config", None)
          if attention_config is None:
              hparams.model.attention_config = (
                  ml_collections.ConfigDict()
              )
          att_type = hparams.model.attention_config.get("type", None)
  
          # Default ViViT.
          if att_type is None:
              hparams.model.attention_config.type = "spacetime"
  
          # Handle V3.
          elif att_type == "factorised_space_time":
              hparams.model.attention_config.type = (
                  "factorized_self_attention_block"
              )
  
          # Handle V1.
          if (
              hparams.get("model_variant", "vivit")
              == "space_time_vivit"
          ):
              hparams.model.attention_config.type = "factorized_encoder"
  
      return hparams
  
imports: from typing import Any, Optional, Tuple
  from absl import logging
  import flax
  from flax.linen import linear
  from flax.training import common_utils
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.common_lib import debug_utils
  from scenic.model_lib.base_models import model_utils
  import scipy
label_desc: Use image node_id 16 for calling a global function with example usage: adapt_old_configs(hparams) and returns: hparams