def try_polynomial(func, z):
 (abuckets, bbuckets) = (sift(func.ap, _mod1), sift(func.bq, _mod1))
 a0 = abuckets[S(0)]
 b0 = bbuckets[S(0)]
 a0.sort()
 b0.sort()
 al0 = [x for x in a0 if (x <= 0)]
 bl0 = [x for x in b0 if (x <= 0)]
 if bl0:
  return oo
 if (not al0):
  return None
 a = al0[(-1)]
 fac = 1
 res = S(1)
 for n in Tuple(*list(range((- a)))):
  fac *= z
  fac /= (n + 1)
  for a in func.ap:
   fac *= (a + n)
  for b in func.bq:
   fac /= (b + n)
  res += fac
 return res

def try_polynomial ( func , z ) : ( abuckets , bbuckets ) = ( sift ( func . ap , _mod1 ) , sift ( func . bq , _mod1 ) ) a0 = abuckets [ S ( 0 ) ] b0 = bbuckets [ S ( 0 ) ] a0 . sort ( ) b0 . sort ( ) al0 = [ x for x in a0 if ( x <= 0 ) ] bl0 = [ x for x in b0 if ( x <= 0 ) ] if bl0 : return oo if ( not al0 ) : return None a = al0 [ ( - 1 ) ] fac = 1 res = S ( 1 ) for n in Tuple ( * list ( range ( ( - a ) ) ) ) : fac *= z fac /= ( n + 1 ) for a in func . ap : fac *= ( a + n ) for b in func . bq : fac /= ( b + n ) res += fac return res
recognise polynomial cases .