'Get a permitted action by its dict key or action name'

def get_action(self, name, default=None):

    for (k, v) in self.permitted_actions.items():
        if ((k == name) or (v.action == name)):
            return v
    return default
