code: def cpu_count(only_physical_cores=False):
      """Return the number of CPUs the current process can use.
  
      The returned number of CPUs accounts for:
       * the number of CPUs in the system, as given by
         ``multiprocessing.cpu_count``;
       * the CPU affinity settings of the current process
         (available on some Unix systems);
       * Cgroup CPU bandwidth limit (available on Linux only, typically
         set by docker and similar container orchestration systems);
       * the value of the LOKY_MAX_CPU_COUNT environment variable if defined.
      and is given as the minimum of these constraints.
  
      If ``only_physical_cores`` is True, return the number of physical cores
      instead of the number of logical cores (hyperthreading / SMT). Note that
      this option is not enforced if the number of usable cores is controlled in
      any other way such as: process affinity, Cgroup restricted CPU bandwidth
      or the LOKY_MAX_CPU_COUNT environment variable. If the number of physical
      cores is not found, return the number of logical cores.
  
      Note that on Windows, the returned number of CPUs cannot exceed 61 (or 60 for
      Python < 3.10), see:
      https://bugs.python.org/issue26903.
  
      It is also always larger or equal to 1.
      """
      # Note: os.cpu_count() is allowed to return None in its docstring
      os_cpu_count = os.cpu_count() or 1
      if sys.platform == "win32":
          # On Windows, attempting to use more than 61 CPUs would result in a
          # OS-level error. See https://bugs.python.org/issue26903. According to
          # https://learn.microsoft.com/en-us/windows/win32/procthread/processor-groups
          # it might be possible to go beyond with a lot of extra work but this
          # does not look easy.
          os_cpu_count = min(os_cpu_count, _MAX_WINDOWS_WORKERS)
  
      cpu_count_user = _cpu_count_user(os_cpu_count)
      aggregate_cpu_count = max(min(os_cpu_count, cpu_count_user), 1)
  
      if not only_physical_cores:
          return aggregate_cpu_count
  
      if cpu_count_user < os_cpu_count:
          # Respect user setting
          return max(cpu_count_user, 1)
  
      cpu_count_physical, exception = _count_physical_cores()
      if cpu_count_physical != "not found":
          return cpu_count_physical
  
      # Fallback to default behavior
      if exception is not None:
          # warns only the first time
          warnings.warn(
              "Could not find the number of physical cores for the "
              f"following reason:\n{exception}\n"
              "Returning the number of logical cores instead. You can "
              "silence this warning by setting LOKY_MAX_CPU_COUNT to "
              "the number of cores you want to use."
          )
          traceback.print_tb(exception.__traceback__)
  
      return aggregate_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 4 for calling a global function with example usage: cpu_count(only_physical_cores) and returns: aggregate_cpu_count, aggregate_cpu_count, max, cpu_count_physical