code: def getdefaultlocale(
      envvars=("LC_ALL", "LC_CTYPE", "LANG", "LANGUAGE")
  ):
      """Tries to determine the default locale settings and returns
      them as tuple (language code, encoding).
  
      According to POSIX, a program which has not called
      setlocale(LC_ALL, "") runs using the portable 'C' locale.
      Calling setlocale(LC_ALL, "") lets it use the default locale as
      defined by the LANG variable. Since we don't want to interfere
      with the current locale setting we thus emulate the behavior
      in the way described above.
  
      To maintain compatibility with other platforms, not only the
      LANG variable is tested, but a list of variables given as
      envvars parameter. The first found to be defined will be
      used. envvars defaults to the search path used in GNU gettext;
      it must always contain the variable name 'LANG'.
  
      Except for the code 'C', the language code corresponds to RFC
      1766.  code and encoding can be None in case the values cannot
      be determined.
  
      """
  
      import warnings
  
      warnings._deprecated(
          "locale.getdefaultlocale",
          "{name!r} is deprecated and slated for removal in Python {remove}. "
          "Use setlocale(), getencoding() and getlocale() instead.",
          remove=(3, 15),
      )
  
      try:
          # check if it's supported by the _locale module
          import _locale
  
          code, encoding = _locale._getdefaultlocale()
      except (ImportError, AttributeError):
          pass
      else:
          # make sure the code/encoding values are valid
          if sys.platform == "win32" and code and code[:2] == "0x":
              # map windows language identifier to language name
              code = windows_locale.get(int(code, 0))
          # ...add other platform-specific processing here, if
          # necessary...
          return code, encoding
  
      # fall back on POSIX behaviour
      import os
  
      lookup = os.environ.get
      for variable in envvars:
          localename = lookup(variable, None)
          if localename:
              if variable == "LANGUAGE":
                  localename = localename.split(":")[0]
              break
      else:
          localename = "C"
      return _parse_localename(localename)
  
imports: import sys
  import encodings
  import encodings.aliases
  import re
  import _collections_abc
  from builtins import str
  import functools
label_desc: Use image node_id 23 for calling a global function with example usage: getdefaultlocale(envvars) and returns: _parse_localename, code,  encoding