def _distribute_gens_by_base(base, gens):
 base_len = len(base)
 degree = gens[0].size
 stabs = [[] for _ in range(base_len)]
 max_stab_index = 0
 for gen in gens:
  j = 0
  while ((j < (base_len - 1)) and (gen._array_form[base[j]] == base[j])):
   j += 1
  if (j > max_stab_index):
   max_stab_index = j
  for k in range((j + 1)):
   stabs[k].append(gen)
 for i in range((max_stab_index + 1), base_len):
  stabs[i].append(_af_new(list(range(degree))))
 return stabs

def _distribute_gens_by_base ( base , gens ) : base_len = len ( base ) degree = gens [ 0 ] . size stabs = [ [ ] for _ in range ( base_len ) ] max_stab_index = 0 for gen in gens : j = 0 while ( ( j < ( base_len - 1 ) ) and ( gen . _array_form [ base [ j ] ] == base [ j ] ) ) : j += 1 if ( j > max_stab_index ) : max_stab_index = j for k in range ( ( j + 1 ) ) : stabs [ k ] . append ( gen ) for i in range ( ( max_stab_index + 1 ) , base_len ) : stabs [ i ] . append ( _af_new ( list ( range ( degree ) ) ) ) return stabs
distribute the group elements gens by membership in basic stabilizers .