'Manage the action for the current stat'

def manage_action(self, stat_name, trigger, header, action_key):

    try:
        (command, repeat) = self.get_limit_action(trigger, stat_name=stat_name)
    except KeyError:
        self.actions.set(stat_name, trigger)
    else:
        if (action_key is None):
            action_key = header
        if isinstance(self.get_stats_action(), list):
            mustache_dict = {}
            for item in self.get_stats_action():
                if (item[self.get_key()] == action_key):
                    mustache_dict = item
                    break
        else:
            mustache_dict = self.get_stats_action()
        self.actions.run(stat_name, trigger, command, repeat, mustache_dict=mustache_dict)
