import re


def _test_action(requested_action, permission):
    """ Determine if the requested action falls within a permission """
    permission = permission.replace("*", ".*")
    match = re.match(permission.lower(), requested_action.lower())
    return match is not None