code: def cur_model(model=None):
      
      if model is None:
          if _system.currentmodel is not None:
              return _system.currentmodel.interface
          else:
              return None
      else:
          if isinstance(model, _Model):
              _system.currentmodel = model._impl
          else:
              _system.currentmodel = _system.models[model]
  
          return _system.currentmodel.interface
docs: Get and/or set the current model.
  
      If ``model`` is given, set the current model to ``model`` and return it.
      ``model`` can be the name of a model object, or a model object itself.
      If ``model`` is not given, the current model is returned.