def _filtered_gens(poly, symbol):
 gens = {g for g in poly.gens if (symbol in g.free_symbols)}
 for g in list(gens):
  ag = (1 / g)
  if ((g in gens) and (ag in gens)):
   if (ag.as_numer_denom()[1] is not S.One):
    g = ag
   gens.remove(g)
 return gens

def _filtered_gens ( poly , symbol ) : gens = { g for g in poly . gens if ( symbol in g . free_symbols ) } for g in list ( gens ) : ag = ( 1 / g ) if ( ( g in gens ) and ( ag in gens ) ) : if ( ag . as_numer_denom ( ) [ 1 ] is not S . One ) : g = ag gens . remove ( g ) return gens
process the generators of poly .