code: def wrap_deepmind(env, dim=84, framestack=True):
      
      env = MonitorEnv(env)
      env = NoopResetEnv(env, noop_max=30)
      if "NoFrameskip" in env.spec.id:
          env = MaxAndSkipEnv(env, skip=4)
      env = EpisodicLifeEnv(env)
      if "FIRE" in env.unwrapped.get_action_meanings():
          env = FireResetEnv(env)
      env = WarpFrame(env, dim)
      # env = ScaledFloatFrame(env)  # TODO: use for dqn?
      # env = ClipRewardEnv(env)  # reward clipping is handled by policy eval
      if framestack:
          env = FrameStack(env, 4)
      return env
docs: Configure environment for DeepMind-style Atari.
  
      Note that we assume reward clipping is done outside the wrapper.
  
      Args:
          dim (int): Dimension to resize observations to (dim x dim).
          framestack (bool): Whether to framestack observations.