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'>,
                '_skip_schema_validation': False,
            },
        }

    """
    routes = {}
    for attr_name in dir(obj):
        attr = getattr(obj, attr_name)
        for option in ['_on_action', '_after_action']:
            try:
                action = getattr(attr, option)
                if action not in routes:
                    routes[action] = {}
                if option == '_on_action':
                    routes[action]['_skip_schema_validation'] = getattr(attr,
                        '_skip_schema_validation', False)
                routes[action][option] = attr
            except AttributeError:
                continue
    return routes
