code: def is_bandit_env(env):
      actual_env = env
      if isinstance(env, tf_py_environment.TFPyEnvironment):
          actual_env = env.pyenv
          if isinstance(actual_env, wrappers.PyEnvironmentBaseWrapper):
              actual_env = actual_env.wrapped_env()
      is_bandit = isinstance(
          actual_env, bandit_py_environment.BanditPyEnvironment
      ) or isinstance(
          actual_env, bandit_tf_environment.BanditTFEnvironment
      )
      return is_bandit
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gin
  import tensorflow
  from tf_agents.bandits.environments import bandit_py_environment
  from tf_agents.bandits.environments import bandit_tf_environment
  from tf_agents.drivers import driver
  from tf_agents.environments import tf_py_environment
  from tf_agents.environments import wrappers
  from tf_agents.trajectories import time_step
  from tf_agents.trajectories import trajectory
  from tf_agents.utils import common
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 1 for calling a global function with example usage: is_bandit_env(env) and returns: is_bandit