code: def _get_viewer(
      self, mode
  ) -> Union[
      "mujoco_py.MjViewer", "mujoco_py.MjRenderContextOffscreen"
  ]:
      self.viewer = self._viewers.get(mode)
      if self.viewer is None:
          if mode == "human":
              self.viewer = mujoco_py.MjViewer(self.sim)
  
          elif mode in {"rgb_array", "depth_array"}:
              self.viewer = mujoco_py.MjRenderContextOffscreen(
                  self.sim, -1
              )
          else:
              raise AttributeError(
                  f"Unknown mode: {mode}, expected modes: {self.metadata['render_modes']}"
              )
  
          self.viewer_setup()
          self._viewers[mode] = self.viewer
  
      return self.viewer
  
imports: from os import path
  from typing import Optional, Union
  import numpy
  import gym
  from gym import error, logger, spaces
  from gym.spaces import Space
label_desc: Use image node_id 7 for calling the MuJocoPyEnv obj's underlying member method code with example usage: obj._get_viewer(mode) and returns: self