docs: def set_affinity(pid, cpuset):
      """
      Sets  the  CPU  affinity  mask of the process whose ID is pid to the value specified by mask.
  
      If pid is zero, then the calling process is used.
  
      @param pid: process PID (0 == current process)
      @type pid: C{int}
      @param cpuset: set of CPU ids
      @type cpuset: C{set}
      """
      _cpuset = cpu_set_t()
      __CPU_ZERO(_cpuset)
  
      for i in cpuset:
          if i in range(0, sizeof(cpu_set_t) * 8):
              __CPU_SET(i, _cpuset)
  
      if libnuma.sched_setaffinity(pid, sizeof(cpu_set_t), byref(_cpuset)) < 0:
          raise RuntimeError()