docs: def enforce(self, rule, target, creds, exc=None, *args, **kwargs):
          """Checks authorization of a rule against the target and credentials."""
  
          self.load_rules()
  
          if isinstance(rule, checks.BaseCheck):
              result = rule(target, creds, self, rule)
          elif not self.rules:
              # No rules means we're going to fail closed.
              result = False
          else:
              try:
                  # Evaluate the rule
                  result = self.rules[rule](target, creds, self, rule)
              except KeyError:
                  LOG.debug('Rule [%s] does not exist', rule)
                  # If the rule doesn't exist, fail closed
                  result = False
  
          if self.raise_error and not result:
              if exc:
                  raise exc(*args, **kwargs)
              else:
                  raise PolicyNotAuthorized(rule, target, creds)
  
          return result