import re


def is_invocation_allowed(command_requested, exact_allowed=[], regex_allowed=[]):
    """
        Check if command_requested is an element of exact_allowed or if it
        matches a pattern in regex_allowed. If so, then return True.
    """
    allowed = False
    if command_requested in exact_allowed:
        allowed = True
    else:
        for regexp in regex_allowed:
            if re.match(regexp, command_requested):
                allowed = True
                break
    return allowed