code: def get_wrapper_by_cls(env, cls):
      """Returns the gym env wrapper of the given class, or None."""
      currentenv = env
      while True:
          if isinstance(currentenv, cls):
              return currentenv
          elif isinstance(currentenv, gym.Wrapper):
              currentenv = currentenv.env
          else:
              return None
  
imports: import time
  import numpy
  from collections import deque
  import gym
  from gym import spaces
  from parl.env.compat_wrappers import CompatWrapper, is_gym_version_ge, V_NPRANDOM_CHANGED
  import cv2
label_desc: Use image node_id 1 for calling a global function with example usage: get_wrapper_by_cls(env, cls) and returns: currentenv, None