code: def parse(
      fp=None,
      environ=os.environ,
      keep_blank_values=0,
      strict_parsing=0,
      separator="&",
  ):
      """Parse a query in the environment or from a file (default stdin)
  
      Arguments, all optional:
  
      fp              : file pointer; default: sys.stdin.buffer
  
      environ         : environment dictionary; default: os.environ
  
      keep_blank_values: flag indicating whether blank values in
          percent-encoded forms should be treated as blank strings.
          A true value indicates that blanks should be retained as
          blank strings.  The default false value indicates that
          blank values are to be ignored and treated as if they were
          not included.
  
      strict_parsing: flag indicating what to do with parsing errors.
          If false (the default), errors are silently ignored.
          If true, errors raise a ValueError exception.
  
      separator: str. The symbol to use for separating the query arguments.
          Defaults to &.
      """
      if fp is None:
          fp = sys.stdin
  
      # field keys and values (except for files) are returned as strings
      # an encoding is required to decode the bytes read from self.fp
      if hasattr(fp, "encoding"):
          encoding = fp.encoding
      else:
          encoding = "latin-1"
  
      # fp.read() must return bytes
      if isinstance(fp, TextIOWrapper):
          fp = fp.buffer
  
      if not "REQUEST_METHOD" in environ:
          environ["REQUEST_METHOD"] = "GET"  # For testing stand-alone
      if environ["REQUEST_METHOD"] == "POST":
          ctype, pdict = parse_header(environ["CONTENT_TYPE"])
          if ctype == "multipart/form-data":
              return parse_multipart(fp, pdict, separator=separator)
          elif ctype == "application/x-www-form-urlencoded":
              clength = int(environ["CONTENT_LENGTH"])
              if maxlen and clength > maxlen:
                  raise ValueError("Maximum content length exceeded")
              qs = fp.read(clength).decode(encoding)
          else:
              qs = ""  # Unknown content-type
          if "QUERY_STRING" in environ:
              if qs:
                  qs = qs + "&"
              qs = qs + environ["QUERY_STRING"]
          elif sys.argv[1:]:
              if qs:
                  qs = qs + "&"
              qs = qs + sys.argv[1]
          environ["QUERY_STRING"] = qs  # XXX Shouldn't, really
      elif "QUERY_STRING" in environ:
          qs = environ["QUERY_STRING"]
      else:
          if sys.argv[1:]:
              qs = sys.argv[1]
          else:
              qs = ""
          environ["QUERY_STRING"] = qs  # XXX Shouldn't, really
      return urllib.parse.parse_qs(
          qs,
          keep_blank_values,
          strict_parsing,
          encoding=encoding,
          separator=separator,
      )
  
imports: from io import StringIO, BytesIO, TextIOWrapper
  from collections.abc import Mapping
  import sys
  import os
  import urllib.parse
  from email.parser import FeedParser
  from email.message import Message
  import html
  import locale
  import tempfile
  import warnings
label_desc: Use image node_id 5 for calling a global function with example usage: parse(fp, environ, keep_blank_values, strict_parsing, separator) and returns: urllib, parse_multipart