code: def libc_ver(executable=None, lib="", version="", chunksize=16384):
      """Tries to determine the libc version that the file executable
      (which defaults to the Python interpreter) is linked against.
  
      Returns a tuple of strings (lib,version) which default to the
      given parameters in case the lookup fails.
  
      Note that the function has intimate knowledge of how different
      libc versions add symbols to the executable and thus is probably
      only usable for executables compiled using gcc.
  
      The file is read and scanned in chunks of chunksize bytes.
  
      """
      if not executable:
          try:
              ver = os.confstr("CS_GNU_LIBC_VERSION")
              # parse 'glibc 2.28' as ('glibc', '2.28')
              parts = ver.split(maxsplit=1)
              if len(parts) == 2:
                  return tuple(parts)
          except (AttributeError, ValueError, OSError):
              # os.confstr() or CS_GNU_LIBC_VERSION value not available
              pass
  
          executable = sys.executable
  
          if not executable:
              # sys.executable is not set.
              return lib, version
  
      libc_search = re.compile(
          b"(__libc_init)"
          b"|"
          b"(GLIBC_([0-9.]+))"
          b"|"
          rb"(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)",
          re.ASCII,
      )
  
      V = _comparable_version
      # We use os.path.realpath()
      # here to work around problems with Cygwin not being
      # able to open symlinks for reading
      executable = os.path.realpath(executable)
      with open(executable, "rb") as f:
          binary = f.read(chunksize)
          pos = 0
          while pos < len(binary):
              if b"libc" in binary or b"GLIBC" in binary:
                  m = libc_search.search(binary, pos)
              else:
                  m = None
              if not m or m.end() == len(binary):
                  chunk = f.read(chunksize)
                  if chunk:
                      binary = (
                          binary[max(pos, len(binary) - 1000) :] + chunk
                      )
                      pos = 0
                      continue
                  if not m:
                      break
              libcinit, glibc, glibcversion, so, threads, soversion = [
                  s.decode("latin1") if s is not None else s
                  for s in m.groups()
              ]
              if libcinit and not lib:
                  lib = "libc"
              elif glibc:
                  if lib != "glibc":
                      lib = "glibc"
                      version = glibcversion
                  elif V(glibcversion) > V(version):
                      version = glibcversion
              elif so:
                  if lib != "glibc":
                      lib = "libc"
                      if soversion and (
                          not version or V(soversion) > V(version)
                      ):
                          version = soversion
                      if (
                          threads
                          and version[-len(threads) :] != threads
                      ):
                          version = version + threads
              pos = m.end()
      return lib, version
  
imports: import collections
  import os
  import re
  import sys
  import functools
  import itertools
label_desc: Use image node_id 2 for calling a global function with example usage: libc_ver(executable, lib, version, chunksize) and returns: lib,  version, lib,  version, tuple