def obs_space_info(obs_space):
if isinstance(obs_space, gym.spaces.Dict):<EOL><INDENT>assert isinstance(obs_space.spaces, OrderedDict)<EOL>subspaces = obs_space.spaces<EOL><DEDENT>else:<EOL><INDENT>subspaces = {None: obs_space}<EOL><DEDENT>keys = []<EOL>shapes = {}<EOL>dtypes = {}<EOL>for key, box in subspaces.items():<EOL><INDENT>keys.append(key)<EOL>shapes[key] = box.shape<EOL>dtypes[key] = box.dtype<EOL><DEDENT>return keys, shapes, dtypes<EOL>
Get dict-structured information about a gym.Space.

Returns:
  A tuple (keys, shapes, dtypes):
    keys: a list of dict keys.
    shapes: a dict mapping keys to shapes.
    dtypes: a dict mapping keys to dtypes.