def _strip(g, base, orbits, transversals):
 h = g._array_form
 base_len = len(base)
 for i in range(base_len):
  beta = h[base[i]]
  if (beta == base[i]):
   continue
  if (beta not in orbits[i]):
   return (_af_new(h), (i + 1))
  u = transversals[i][beta]._array_form
  h = _af_rmul(_af_invert(u), h)
 return (_af_new(h), (base_len + 1))

def _strip ( g , base , orbits , transversals ) : h = g . _array_form base_len = len ( base ) for i in range ( base_len ) : beta = h [ base [ i ] ] if ( beta == base [ i ] ) : continue if ( beta not in orbits [ i ] ) : return ( _af_new ( h ) , ( i + 1 ) ) u = transversals [ i ] [ beta ] . _array_form h = _af_rmul ( _af_invert ( u ) , h ) return ( _af_new ( h ) , ( base_len + 1 ) )
attempt to decompose a permutation using a bsgs structure .