<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def load_module(modname, quiet=False, **kwargs):
    '''load a module'''
    modpaths = ['MAVProxy.modules.mavproxy_%s' % modname, modname]
    for (m,pm) in mpstate.modules:
        if m.name == modname and not modname in mpstate.multi_instance:
            if not quiet:
                print("module %s already loaded" % modname)
            # don't report an error
            return True
    ex = None
    for modpath in modpaths:
        try:
            m = import_package(modpath)
            reload(m)
            module = m.init(mpstate, **kwargs)
            if isinstance(module, mp_module.MPModule):
                mpstate.modules.append((module, m))
                if not quiet:
                    if kwargs:
                        print("Loaded module %s with kwargs = %s" % (modname, kwargs))
                    else:
                        print("Loaded module %s" % (modname,))
                return True
            else:
                ex = "%s.init did not return a MPModule instance" % modname
                break
        except ImportError as msg:
            ex = msg
            if mpstate.settings.moddebug > 1:
                import traceback
                print(traceback.format_exc())
    help_traceback = ""
    if mpstate.settings.moddebug < 3:
        help_traceback = " Use 'set moddebug 3' in the MAVProxy console to enable traceback"
    print("Failed to load module: %s.%s" % (ex, help_traceback))
    return False