docs: def indexable_role(principal):
      """Return a string suitable for query against `allowed_roles_and_users`
      field.
  
      :param principal: It can be :data:`Anonymous`, :data:`Authenticated`,
        or an instance of :class:`User` or :class:`Group`.
      """
      principal = unwrap(principal)
  
      if hasattr(principal, "is_anonymous") and principal.is_anonymous:
          # transform anonymous user to anonymous role
          principal = Anonymous
  
      if isinstance(principal, Role):
          return f"role:{principal.name}"
      elif isinstance(principal, User):
          fmt = "user:{:d}"
      elif isinstance(principal, Group):
          fmt = "group:{:d}"
      else:
          raise ValueError(repr(principal))
  
      return fmt.format(principal.id)