def _filter_for_numa_threads(possible, wantthreads):
 mostthreads = 0
 for topology in possible:
  if (topology.threads > wantthreads):
   continue
  if (topology.threads > mostthreads):
   mostthreads = topology.threads
 bestthreads = []
 for topology in possible:
  if (topology.threads != mostthreads):
   continue
  bestthreads.append(topology)
 return bestthreads

def _filter_for_numa_threads ( possible , wantthreads ) : mostthreads = 0 for topology in possible : if ( topology . threads > wantthreads ) : continue if ( topology . threads > mostthreads ) : mostthreads = topology . threads bestthreads = [ ] for topology in possible : if ( topology . threads != mostthreads ) : continue bestthreads . append ( topology ) return bestthreads
filter topologies which closest match to numa threads .