def create_route_map(obj):
    """
    Iterates of all attributes of the class looking for attributes which
    have been decorated by the @on() decorator It returns a dictionary where
    the action name are the keys and the decorated functions are the values.

    To illustrate this with an example, consider the following function:

        class ChargePoint:

            @on(Action.BootNotification)
            def on_boot_notification(self, *args, **kwargs):
                pass

            @after(Action.BootNotification)
            def after_boot_notification(self, *args, **kwargs):
                pass


    In this case this returns:

        {
            Action.BootNotification: {
                '_on_action': <reference to 'on_boot_notification'>,
                '_after_action': <reference to 'after_boot_notification'>,
            },
        }

    """
    routes = {}
    for attr_name in dir(obj):
        attr = getattr(obj, attr_name)
        for hook in ['_on_action', '_after_action']:
            try:
                action = getattr(attr, hook)

                if action not in routes:
                    routes[action] = {}
                routes[action][hook] = attr

            except AttributeError:
                continue

    return routes