code: def flatten(space: Space[T], x: T) -> FlatType:
      """Flatten a data point from a space.
  
      This is useful when e.g. points from spaces must be passed to a neural
      network, which only understands flat arrays of floats.
  
      Args:
          space: The space that ``x`` is flattened by
          x: The value to flatten
  
      Returns:
          - For ``Box`` and ``MultiBinary``, this is a flattened array
          - For ``Discrete`` and ``MultiDiscrete``, this is a flattened one-hot array of the sample
          - For ``Tuple`` and ``Dict``, this is a concatenated array the subspaces (does not support graph subspaces)
          - For graph spaces, returns `GraphInstance` where:
              - `nodes` are n x k arrays
              - `edges` are either:
                  - m x k arrays
                  - None
              - `edge_links` are either:
                  - m x 2 arrays
                  - None
  
      Raises:
          NotImplementedError: If the space is not defined in ``gym.spaces``.
      """
      raise NotImplementedError(f"Unknown space: `{space}`")
  
imports: import operator
  from collections import OrderedDict
  from functools import reduce, singledispatch
  from typing import Dict
  from typing import TypeVar, Union, cast
  import numpy
  from gym.spaces import Box, Dict, Discrete, Graph, GraphInstance, MultiBinary, MultiDiscrete, Sequence, Space, Text, Tuple
label_desc: Use image node_id 9 for calling a global function with example usage: flatten(space, x) without return types