code: def convert_gym_space(spc):
      """Converts a :gym:`gym.Space <#spaces>` instance to a
      :class:`~texar.tf.agents.Space` instance.
  
      Args:
          spc: An instance of `gym.Space` or
              :class:`~texar.tf.agents.Space`.
      """
      from texar.tf.agents.agent_utils import Space
  
      if isinstance(spc, Space):
          return spc
      if isinstance(spc, gym.spaces.Discrete):
          return Space(shape=(), low=0, high=spc.n, dtype=spc.dtype)
      elif isinstance(spc, gym.spaces.Box):
          return Space(
              shape=spc.shape,
              low=spc.low,
              high=spc.high,
              dtype=spc.dtype,
          )
  
label_desc: Use image node_id 1 for calling a global function with example usage: convert_gym_space(spc) and returns: spc, Space, Space