code: def test_read_from_shared_memory(space):
      def assert_nested_equal(lhs, rhs, space, n):
          assert isinstance(rhs, list)
          if isinstance(space, Tuple):
              assert isinstance(lhs, tuple)
              for i in range(len(lhs)):
                  assert_nested_equal(
                      lhs[i],
                      [rhs_[i] for rhs_ in rhs],
                      space.spaces[i],
                      n,
                  )
  
          elif isinstance(space, Dict):
              assert isinstance(lhs, OrderedDict)
              for key in lhs.keys():
                  assert_nested_equal(
                      lhs[key],
                      [rhs_[key] for rhs_ in rhs],
                      space.spaces[key],
                      n,
                  )
  
          elif isinstance(space, BaseGymSpaces):
              assert isinstance(lhs, np.ndarray)
              assert lhs.shape == ((n,) + space.shape)
              assert lhs.dtype == space.dtype
              assert np.all(lhs == np.stack(rhs, axis=0))
  
          else:
              raise TypeError(f"Got unknown type `{type(space)}`")
  
      shared_memory_n8 = create_shared_memory(space, n=8)
      memory_view_n8 = read_from_shared_memory(
          space, shared_memory_n8, n=8
      )
      samples = [space.sample() for _ in range(8)]
  
      processes = [
          Process(
              target=_process_write,
              args=(space, i, shared_memory_n8, samples[i]),
          )
          for i in range(8)
      ]
  
      for process in processes:
          process.start()
      for process in processes:
          process.join()
  
      assert_nested_equal(memory_view_n8, samples, space, n=8)
  
file_path: gym/tests/vector/test_shared_memory.py
imports: import multiprocessing
  from collections import OrderedDict
  from multiprocessing import Array, Process
  from multiprocessing.sharedctypes import SynchronizedArray
  import numpy
  import pytest
  from gym.error import CustomSpaceError
  from gym.spaces import Dict, Tuple
  from gym.vector.utils.shared_memory import create_shared_memory, read_from_shared_memory, write_to_shared_memory
  from gym.vector.utils.spaces import BaseGymSpaces
  from tests.vector.utils import custom_spaces, spaces
label_desc: Use image node_id 6 for calling a global function with example usage: test_read_from_shared_memory(space) without return types