docs: def _slug_strip(value, separator='-'):
      """
      Cleans up a slug by removing slug separator characters that occur at the
      beginning or end of a slug.
  
      If an alternate separator is used, it will also replace any instances of
      the default '-' separator with the new separator.
      """
      separator = separator or ''
      if separator == '-' or not separator:
          re_sep = '-'
      else:
          re_sep = '(?:-|%s)' % re.escape(separator)
      # Remove multiple instances and if an alternate separator is provided,
      # replace the default '-' separator.
      if separator != re_sep:
          value = re.sub('%s+' % re_sep, separator, value)
      # Remove separator from the beginning and end of the slug.
      if separator:
          if separator != '-':
              re_sep = re.escape(separator)
          value = re.sub(r'^%s+|%s+$' % (re_sep, re_sep), '', value)
      return value