code: def _get_docker_cpu_quota():
      """Checks for available cpu cores in a containerized environment.
  
      If you witness memory leaks while doing multiple predictions using docker
      see https://github.com/tensorflow/tensorflow/issues/22098.
      """
      cpu_cores = None
  
      # Check for quotas if we are in a linux container
      cfs_period = Path("/sys/fs/cgroup/cpu/cpu.cfs_period_us")
      cfs_quota = Path("/sys/fs/cgroup/cpu/cpu.cfs_quota_us")
  
      if cfs_period.exists() and cfs_quota.exists():
          with cfs_period.open("rb") as p, cfs_quota.open("rb") as q:
              p_int, q_int = int(p.read()), int(q.read())
  
              # get the cores allocated by dividing the quota
              # in microseconds by the period in microseconds
              if q_int > 0 and p_int > 0:
                  cpu_cores = math.ceil(q_int / p_int)
  
      return cpu_cores
  
imports: import json
  import logging
  import math
  from abc import ABC
  from abc import abstractmethod
  from collections import OrderedDict
  from pathlib import Path
  import tensorflow
  from .player import Player
label_desc: Use image node_id 2 for calling a global function with example usage: _get_docker_cpu_quota() and returns: cpu_cores