def _decode_action_type(routes, topic):
    """
    Decode an inbound MQTT topic into an action type.

    :param routes: The routing dict
    :type routes: dict

    :param topic: The MQTT topic
    :type topic: str

    :returns: The action type
    """
    for handle, route in routes.items():
        if topic.startswith(route):
            return '@' + topic.replace(route, handle)
    return topic
