Imports the requested controller.  Controllers are specified in a
    URI-like manner; the scheme is looked up using the entry point
    group "appathy.loader".  Appathy supports the "call:" and "egg:"
    schemes by default.

def import_controller(string):
    """
    Imports the requested controller.  Controllers are specified in a
    URI-like manner; the scheme is looked up using the entry point
    group "appathy.loader".  Appathy supports the "call:" and "egg:"
    schemes by default.
    """

    # Split out the scheme and the controller descriptor
    scheme, sep, controller = string.partition(':')
    if sep != ':':
        raise ImportError("No loader scheme specified by %r" % string)

    # Look up a loader for that scheme
    for ep in pkg_resources.iter_entry_points('appathy.loader', scheme):
        try:
            loader = ep.load()
            break
        except (ImportError, pkg_resources.UnknownExtra):
            continue
    else:
        raise ImportError("Unable to find loader for scheme %r" % scheme)

    # Load the controller
    return loader(controller)