code: def known_space(obj, spaces=None):
      """If `obj` is in a known space, return the space, otherwise return None
  
      Parameters
      ----------
      obj : object
          Object that can be tested against an XYZSpace with ``obj in sp``
      spaces : None or sequence, optional
          spaces to test against.  If None, use the module level ``known_spaces``
          list to test against.
  
      Returns
      -------
      sp : None or XYZSpace
          If `obj` is not in any of the `known_spaces`, return None.  Otherwise
          return the first matching space in `known_spaces`
  
      Examples
      --------
      >>> from nipy.core.api import CoordinateSystem
      >>> sp0 = XYZSpace('hijo')
      >>> sp1 = XYZSpace('hija')
  
      Make a matching coordinate system
  
      >>> cs = sp0.to_coordsys_maker()(3)
  
      Test whether this coordinate system is in either of ``(sp0, sp1)``
  
      >>> known_space(cs, (sp0, sp1))
      XYZSpace('hijo')
  
      So, yes, it's in ``sp0``. How about another generic CoordinateSystem?
  
      >>> known_space(CoordinateSystem('xyz'), (sp0, sp1)) is None
      True
  
      So, no, that is not in either of ``(sp0, sp1)``
      """
      if spaces is None:
          # use module level global
          spaces = known_spaces
      for sp in spaces:
          if obj in sp:
              return sp
      return None
  
imports: import numpy
  from nibabel import io_orientation
  from nibabel.affines import from_matvec
  from .coordinate_map import CoordMapMaker
  from .coordinate_system import CoordSysMaker, is_coordsys, is_coordsys_maker
label_desc: Use image node_id 1 for calling a global function with example usage: known_space(obj, spaces) and returns: None, sp