code: def cur_space(space=None):
      
      if space is None:
          if _system.currentmodel is not None:
              if _system.currentmodel.currentspace is not None:
                  return _system.currentmodel.currentspace.interface
              else:
                  return None
          else:
              return None
      else:
          if isinstance(space, _Space):
              cur_model(space.model)
              _system.currentmodel.currentspace = space._impl
          else:
              _system.currentmodel.currentspace = _system.currentmodel.spaces[
                  space
              ]
  
          return cur_space()
docs: Get and/or set the current space of the current model.
  
      If ``name`` is given, the current space of the current model is
      set to ``name`` and return it.
      If ``name`` is not given, the current space of the current model
      is returned.