docs: def allow_access_for_roles(roles):
      """Access control helper to check user's roles against a list of valid
      roles."""
      if isinstance(roles, Role):
          roles = (roles,)
      valid_roles = frozenset(roles)
  
      if Anonymous in valid_roles:
          return allow_anonymous
  
      def check_role(user, roles, **kwargs):
          from abilian.services import get_service
  
          security = get_service("security")
          return security.has_role(user, valid_roles)
  
      return check_role