def num_cpus():
 try:
  return psutil.cpu_count()
 except AttributeError:
  return psutil.NUM_CPUS

def num_cpus ( ) : try : return psutil . cpu_count ( ) except AttributeError : return psutil . NUM_CPUS
detects the number of cpus on a system .