<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register_module(self, module, idx=-1):
 """ Register a module. You could indicate position inside inner list. :param module: must be a string or a module object to register. :type module: str :param idx: position where you want to insert new module. By default it is inserted at the end. :type idx: int """


        if module in self._modules:
            raise AlreadyRegisteredError("Module '{0}' is already registered on loader.".format(module))

        if idx < 0:
            self._modules.append(module)
        else:
            self._modules.insert(idx, module)