'Load an extension that, for example, might provide additional
command handlers'

def do_load_extension(self, request):

    path = request.get('module-path', None)
    if (not path):
        raise RequestFailure(msg='load-extension    requires    a    module-path')
    name = request.get('module-name', None)
    if (not name):
        raise RequestFailure(msg='load-extension    requires    a    module-name')
    iinfo = imp.find_module(name, [path])
    try:
        module = imp.load_module(name, *iinfo)
    finally:
        if (iinfo and iinfo[0]):
            iinfo[0].close()
    callback = getattr(module, 'registerExtension', None)
    if (not callback):
        raise RequestFailure(msg=("load-extension    module    %s    should    have    a    'registerExtension'    method    taking    no    arguments" % (name,)))
    callback()
    self.send()
