code: def __init__(self, application, path_prefix):
      """Initializes this middleware.
  
      Args:
        application: The WSGI application to wrap (see PEP 3333).
        path_prefix: A string path prefix to be stripped from incoming
          requests. If empty, this middleware is a no-op. If non-empty,
          the path prefix must start with a slash and not end with one
          (e.g., "/tensorboard").
      """
      if path_prefix.endswith("/"):
          raise ValueError(
              "Path prefix must not end with slash: %r" % path_prefix
          )
      if path_prefix and not path_prefix.startswith("/"):
          raise ValueError(
              "Non-empty path prefix must start with slash: %r"
              % path_prefix
          )
      self._application = application
      self._path_prefix = path_prefix
      self._strict_prefix = self._path_prefix + "/"
  
imports: from tensorboard import errors
label_desc: Use image node_id 1 to create a new PathPrefixMiddleware object  with example: obj = PathPrefixMiddleware(application, path_prefix)