def import_cmdset(path, cmdsetobj, emit_to_obj=None, no_logging=False):
    """
    This helper function is used by the cmdsethandler to load a cmdset
    instance from a python module, given a python_path. It's usually accessed
    through the cmdsethandler's add() and add_default() methods.
    path - This is the full path to the cmdset object on python dot-form

    Args:
        path (str): The path to the command set to load.
        cmdsetobj (CmdSet): The database object/typeclass on which this cmdset is to be
            assigned (this can be also channels and exits, as well as players
            but there will always be such an object)
        emit_to_obj (Object, optional): If given, error is emitted to
            this object (in addition to logging)
        no_logging (bool, optional): Don't log/send error messages.
            This can be useful if import_cmdset is just used to check if
            this is a valid python path or not.
    Returns:
        cmdset (CmdSet): The imported command set. If an error was
            encountered, `commands.cmdsethandler._ErrorCmdSet` is returned
            for the benefit of the handler.

    """
    python_paths = [path] + ["%s.%s" % (prefix, path)
                                    for prefix in _CMDSET_PATHS if not path.startswith(prefix)]
    errstring = ""
    for python_path in python_paths:

        if "." in  path:
            modpath, classname = python_path.rsplit(".", 1)
        else:
            raise ImportError("The path '%s' is not on the form modulepath.ClassName" % path)

        try:
            # first try to get from cache
            cmdsetclass = _CACHED_CMDSETS.get(python_path, None)

            if not cmdsetclass:
                try:
                    module = import_module(modpath, package="evennia")
                except ImportError:
                    if len(trace()) > 2:
                        # error in module, make sure to not hide it.
                        exc = sys.exc_info()
                        raise_(exc[1], None, exc[2])
                    else:
                        # try next suggested path
                        errstring += _("\n(Unsuccessfully tried '%s')." % python_path)
                        continue
                try:
                    cmdsetclass = getattr(module, classname)
                except AttributeError:
                    if len(trace()) > 2:
                        # Attribute error within module, don't hide it
                        exc = sys.exc_info()
                        raise_(exc[1], None, exc[2])
                    else:
                        errstring += _("\n(Unsuccessfully tried '%s')." % python_path)
                        continue
                _CACHED_CMDSETS[python_path] = cmdsetclass

            #instantiate the cmdset (and catch its errors)
            if callable(cmdsetclass):
                cmdsetclass = cmdsetclass(cmdsetobj)
            errstring = ""
            return cmdsetclass
        except ImportError as e:
            logger.log_trace()
            errstring += _("\nError loading cmdset {path}: \"{error}\"")
            errstring = errstring.format(path=python_path, error=e)
            break
        except KeyError:
            logger.log_trace()
            errstring += _("\nError in loading cmdset: No cmdset class '{classname}' in {path}.")
            errstring = errstring.format(classname=classname, path=python_path)
            break
        except SyntaxError as e:
            logger.log_trace()
            errstring += _("\nSyntaxError encountered when loading cmdset '{path}': \"{error}\".")
            errstring = errstring.format(path=python_path, error=e)
            break
        except Exception as e:
            logger.log_trace()
            errstring += _("\nCompile/Run error when loading cmdset '{path}': \"{error}\".")
            errstring = errstring.format(path=python_path, error=e)
            break

    if errstring:
        # returning an empty error cmdset
        errstring = errstring.strip()
        if not no_logging:
            logger.log_err(errstring)
            if emit_to_obj and not ServerConfig.objects.conf("server_starting_mode"):
                emit_to_obj.msg(errstring)
        err_cmdset = _ErrorCmdSet()
        err_cmdset.errmessage = errstring +  _("\n (See log for details.)")
        return err_cmdset

# classes
dataset/ETHPy150Open evennia/evennia/evennia/commands/cmdsethandler.py/import_cmdset/original