code: def play(
      env,
      act,
      craft_adv_obs,
      craft_adv_obs2,
      stochastic,
      video_path,
      attack,
      m_target,
      m_adv,
  ):
      num_episodes = 0
      num_moves = 0
      num_transfer = 0
  
      video_recorder = None
      video_recorder = VideoRecorder(
          env, video_path, enabled=video_path is not None
      )
      obs = env.reset()
      while True:
          env.unwrapped.render()
          video_recorder.capture_frame()
  
          # V: Attack #
          if attack is not None:
              # Craft adv. examples
              with m_adv.get_session().as_default():
                  adv_obs = craft_adv_obs(
                      np.array(obs)[None], stochastic_adv=stochastic
                  )[0]
              with m_target.get_session().as_default():
                  action = act(
                      np.array(adv_obs)[None], stochastic=stochastic
                  )[0]
                  action2 = act(
                      np.array(obs)[None], stochastic=stochastic
                  )[0]
                  num_moves += 1
                  if action != action2:
                      num_transfer += 1
          else:
              # Normal
              action = act(np.array(obs)[None], stochastic=stochastic)[
                  0
              ]
  
          obs, rew, done, info = env.step(action)
          if done:
              obs = env.reset()
  
          if len(info["rewards"]) > num_episodes:
              if len(info["rewards"]) == 1 and video_recorder.enabled:
                  # save video of first episode
                  print("Saved video.")
                  video_recorder.close()
                  video_recorder.enabled = False
              print("Reward: " + str(info["rewards"][-1]))
              num_episodes = len(info["rewards"])
              print("Episode: " + str(num_episodes))
              success = float(num_transfer / num_moves) * 100.0
              print("Percentage of successful attacks: " + str(success))
              num_moves = 0
              num_transfer = 0
  
imports: import argparse
  import gym
  import os
  import numpy
  from gym.monitoring import VideoRecorder
  import rlattack.common.tf_util
  from rlattack import deepq
  from rlattack.common.misc_util import boolean_flag, SimpleMonitor
  from rlattack.common.atari_wrappers_deprecated import wrap_dqn
  import tensorflow
  import cv2
  from collections import deque
  from model import model, dueling_model
  from statistics import statistics
label_desc: Use image node_id 3 for calling a global function with example usage: play(env, act, craft_adv_obs, craft_adv_obs2, stochastic, video_path, attack, m_target, m_adv) without return types