code: def peek_path_info(environ, charset="utf-8", errors="replace"):
      """Returns the next segment on the `PATH_INFO` or `None` if there
      is none.  Works like :func:`pop_path_info` without modifying the
      environment:
      >>> env = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/a/b'}
      >>> peek_path_info(env)
      'a'
      >>> peek_path_info(env)
      'a'
      If the `charset` is set to `None` bytes are returned.
      .. deprecated:: 2.2
          Will be removed in Werkzeug 2.3.
      .. versionadded:: 0.5
      .. versionchanged:: 0.9
         The path is now decoded and a charset and encoding
         parameter can be provided.
      :param environ: the WSGI environment that is checked.
      """
  
      segments = get_path_info(environ).lstrip("/").split("/", 1)
      if segments:
          return _to_str(  # type: ignore
              segments[0].encode("latin1"),
              charset,
              errors,
              allow_none_charset=True,
          )
      return None
  
file_path: dtale/dtale/django/dispatcher.py
imports: import sys
  from threading import Lock
  from werkzeug.wsgi import get_path_info
label_desc: Use image node_id 3 for calling a global function with example usage: peek_path_info(environ, charset, errors) and returns: None, _to_str