code: def test_flatten_roundtripping(space):
      """Tests roundtripping with flattening and unflattening are equal to the original sample."""
      samples = [space.sample() for _ in range(10)]
  
      flattened_samples = [
          utils.flatten(space, sample) for sample in samples
      ]
      unflattened_samples = [
          utils.unflatten(space, sample) for sample in flattened_samples
      ]
  
      for original, roundtripped in zip(samples, unflattened_samples):
          assert data_equivalence(original, roundtripped)
  
file_path: gym/tests/spaces/test_utils.py
imports: from itertools import zip_longest
  from typing import Optional
  import numpy
  import pytest
  import gym
  from gym.spaces import Box, Graph, utils
  from gym.utils.env_checker import data_equivalence
  from tests.spaces.utils import TESTING_SPACES, TESTING_SPACES_IDS
label_desc: Use image node_id 5 for calling a global function with example usage: test_flatten_roundtripping(space) without return types