docs: def get_affinity(pid):
      """
      Returns the affinity mask of the process whose ID is pid.
  
      @param pid: process PID (0 == current process)
      @type pid: C{int}
      @return: set of CPU ids
      @rtype: C{set}
      """
  
      cpuset = cpu_set_t()
      result = set()
  
      libnuma.sched_getaffinity(pid, sizeof(cpu_set_t), byref(cpuset))
  
      for i in range(0, sizeof(cpu_set_t)*8):
          if __CPU_ISSET(i, cpuset):
              result.add(i)
  
      return result