title: Get the same output of the nproc command in Python
body: <p>When using cgroups to limit the number of available CPUs, such as using the <code>--cpuset-cpus</code> flag in Docker, the <code>nproc</code> command prints the number of available CPUs while taking that limit into account. Python's <code>multiprocessing.cpu_count()</code> prints the number of CPUs in the host regardless the cgroup limitation. Which function of Python should be called on order to get the same number returned by <code>nproc</code>? I wish to avoid running the <code>nproc</code> binary using Python.</p>