code: def _get_instance(location, *args, **kwds):
      """given the import location of a model or model class, return the model
  
      args and kwds will be passed to the constructor of the model class
      """
      globals = {}
      package, target = location.rsplit(".", 1)
      code = "from {0} import {1} as model".format(package, target)
      code = compile(code, "<string>", "exec")
      exec(code, globals)
      model = globals["model"]
      import inspect
  
      if inspect.isclass(model):
          model = model(*args, **kwds)
      return model
  
imports: from collections.abc import Callable
label_desc: Use image node_id 18 for calling a global function with example usage: _get_instance(location) and returns: model