code: def gpu_count():
      
      if shutil.which('nvidia-smi') is None:
          return 0
      output = subprocess.check_output(['nvidia-smi', '--query-gpu=gpu_name', '--format=csv'])
      return max(0, len(output.split(b'\n')) - 2)
docs: Count the GPUs on this machine.