code: def infer_game_name_from_filenames(data_dir, snake_case=True):
      """Infer name from filenames."""
      names = os.listdir(data_dir)
      game_names = [
          re.findall(pattern=r"^Gym(.*)NoFrameskip", string=name)
          for name in names
      ]
      assert game_names, "No data files found in {}".format(data_dir)
      game_names = sum(game_names, [])
      game_name = game_names[0]
      assert all(
          game_name == other for other in game_names
      ), "There are multiple different game names in {}".format(
          data_dir
      )
      if snake_case:
          game_name = camelcase_to_snakecase(game_name)
      return game_name
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import os
  import re
  import gym
  import numpy
  import six
  from tensor2tensor.models.research.rl import get_policy
  from tensor2tensor.models.research.rl import make_simulated_env_fn_from_hparams
  from tensor2tensor.rl import rl_utils
  from tensor2tensor.rl.envs.simulated_batch_gym_env import FlatBatchEnv
  from tensor2tensor.utils import hparam
  from tensor2tensor.utils import trainer_lib
  from tensor2tensor.utils.misc_utils import camelcase_to_snakecase
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling a global function with example usage: infer_game_name_from_filenames(data_dir, snake_case) and returns: game_name