code: def _cpu_count_cgroup(os_cpu_count):
      # Cgroup CPU bandwidth limit available in Linux since 2.6 kernel
      cpu_max_fname = "/sys/fs/cgroup/cpu.max"
      cfs_quota_fname = "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"
      cfs_period_fname = "/sys/fs/cgroup/cpu/cpu.cfs_period_us"
      if os.path.exists(cpu_max_fname):
          # cgroup v2
          # https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html
          with open(cpu_max_fname) as fh:
              cpu_quota_us, cpu_period_us = fh.read().strip().split()
      elif os.path.exists(cfs_quota_fname) and os.path.exists(
          cfs_period_fname
      ):
          # cgroup v1
          # https://www.kernel.org/doc/html/latest/scheduler/sched-bwc.html#management
          with open(cfs_quota_fname) as fh:
              cpu_quota_us = fh.read().strip()
          with open(cfs_period_fname) as fh:
              cpu_period_us = fh.read().strip()
      else:
          # No Cgroup CPU bandwidth limit (e.g. non-Linux platform)
          cpu_quota_us = "max"
          cpu_period_us = (
              100_000  # unused, for consistency with default values
          )
  
      if cpu_quota_us == "max":
          # No active Cgroup quota on a Cgroup-capable platform
          return os_cpu_count
      else:
          cpu_quota_us = int(cpu_quota_us)
          cpu_period_us = int(cpu_period_us)
          if cpu_quota_us > 0 and cpu_period_us > 0:
              return math.ceil(cpu_quota_us / cpu_period_us)
          else:  # pragma: no cover
              # Setting a negative cpu_quota_us value is a valid way to disable
              # cgroup CPU bandwith limits
              return os_cpu_count
  
imports: import os
  import sys
  import math
  import subprocess
  import traceback
  import warnings
  import multiprocessing
  from multiprocessing import get_context
  from multiprocessing.context import BaseContext
  from .process import LokyProcess, LokyInitMainProcess
label_desc: Use image node_id 5 for calling a global function with example usage: _cpu_count_cgroup(os_cpu_count) and returns: os_cpu_count, math, os_cpu_count