code: def gym_space_spec(gym_space):
      """Returns a reading spec of a gym space.
  
      NOTE: Only implemented currently for Box and Discrete.
  
      Args:
        gym_space: instance of gym.spaces whose spec we want.
  
      Returns:
        Reading spec for that space.
  
      Raises:
        NotImplementedError: For spaces whose reading spec we haven't implemented.
      """
      # First try to determine the type.
      try:
          tf_dtype = tf.as_dtype(gym_space.dtype)
      except TypeError as e:
          tf.logging.error(
              "Cannot convert space's type [%s] to tf.dtype",
              gym_space.dtype,
          )
          raise e
  
      # Now hand it over to the specialized functions.
      if isinstance(gym_space, Box):
          return box_space_spec(gym_space, tf_dtype)
      elif isinstance(gym_space, Discrete):
          return discrete_space_spec(gym_space, tf_dtype)
      else:
          raise NotImplementedError
  
file_path: tensor2tensor/tensor2tensor/envs/gym_spaces_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from gym.spaces import Box
  from gym.spaces import Discrete
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling a global function with example usage: gym_space_spec(gym_space) and returns: box_space_spec, discrete_space_spec