code: def norm_path(path, allow_trailing=True):
      
  
      # Collapse slashes
      path = _path_re.sub('/', path)
  
      # Force a leading slash
      if path[0] != '/':
          path = '/' + path
  
      # Trim a trailing slash
      if not allow_trailing and path[-1] == '/':
          path = path[:-1]
  
      return path
docs: Normalize a route path.  Ensures that the path begins with a '/'.
      If `allow_trailing` is False, strips off any trailing '/'.  Any
      repeated '/' characters in the path will be collapsed into a
      single one.