ACL rule access decision

Write codeMedium20 minAmazon and Microsoft style

Your task

Resolve an access decision from a list of ACL rules. Each rule is [effect, principal, action] where effect is 'allow' or 'deny'. A rule matches the request (user, action) if its principal equals the user or '', and its action equals the action or ''. Deny takes precedence over allow: if any matching rule denies, the result is 'deny'. Otherwise if any matching rule allows, the result is 'allow'. If no rule matches, the result is 'deny' (default-deny). Return the decision string.

Examples

resolve_acl(rules: list[list[str]], user: str, action: str) -> str
Example 1
Inputresolve_acl([["allow", "alice", "read"], ["deny", "*", "read"]], "alice", "read")
Output"deny"