docs: def as_slug_expression(attr):
      """
      Converts the given instrumented string attribute into an SQL expression
      that can be used as a slug.
  
      Slugs are identifiers for members in a collection that can be used in an
      URL. We create slug columns by replacing non-URL characters with dashes
      and lower casing the result. We need this at the ORM level so that we can
      use the slug in a query expression.
      """
      slug_expr = sa_func.replace(attr, ' ', '-')
      slug_expr = sa_func.replace(slug_expr, '_', '-')
      slug_expr = sa_func.lower(slug_expr)
      return slug_expr