code: def maybe_save_model(savedir, container, state):
      if savedir is None:
          return
      start_time = time.time()
      model_dir = "model-{}".format(state["num_iters"])
      U.save_state(os.path.join(savedir, model_dir, "saved"))
      if container is not None:
          container.put(os.path.join(savedir, model_dir), model_dir)
      relatively_safe_pickle_dump(
          state,
          os.path.join(savedir, "training_state.pkl.zip"),
          compression=True,
      )
      if container is not None:
          container.put(
              os.path.join(savedir, "training_state.pkl.zip"),
              "training_state.pkl.zip",
          )
      relatively_safe_pickle_dump(
          state["monitor_state"],
          os.path.join(savedir, "monitor_state.pkl"),
      )
      if container is not None:
          container.put(
              os.path.join(savedir, "monitor_state.pkl"),
              "monitor_state.pkl",
          )
      logger.log(
          "Saved model in {} seconds\n".format(time.time() - start_time)
      )
  
imports: import argparse
  import gym
  import numpy
  import os
  import tensorflow
  import tempfile
  import time
  import json
  import random
  import rlattack.common.tf_util
  from rlattack import logger
  from rlattack import deepq
  from rlattack.deepq.replay_buffer import ReplayBuffer, PrioritizedReplayBuffer
  from rlattack.common.misc_util import boolean_flag, pickle_load, pretty_eta, relatively_safe_pickle_dump, set_global_seeds, RunningAvg, SimpleMonitor
  from rlattack.common.schedules import LinearSchedule, PiecewiseSchedule
  from rlattack.common.atari_wrappers_deprecated import wrap_dqn
  from rlattack.common.azure_utils import Container
  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: maybe_save_model(savedir, container, state) without return types