code: def enforce_policy(rule):
      
      def wrapper(func):
          """Decorator used for wrap API."""
          @functools.wraps(func)
          def wrapped(*args, **kwargs):
              if enforcer.enforce(rule, {}, g.cred):
                  return func(*args, **kwargs)
  
          return wrapped
  
      return wrapper
docs: Enforce a policy to a API.