def gf_from_dict(f, p, K):
 (n, h) = (max(f.keys()), [])
 if isinstance(n, SYMPY_INTS):
  for k in range(n, (-1), (-1)):
   h.append((f.get(k, K.zero) % p))
 else:
  (n,) = n
  for k in range(n, (-1), (-1)):
   h.append((f.get((k,), K.zero) % p))
 return gf_trunc(h, p)

def gf_from_dict ( f , p , K ) : ( n , h ) = ( max ( f . keys ( ) ) , [ ] ) if isinstance ( n , SYMPY_INTS ) : for k in range ( n , ( - 1 ) , ( - 1 ) ) : h . append ( ( f . get ( k , K . zero ) % p ) ) else : ( n , ) = n for k in range ( n , ( - 1 ) , ( - 1 ) ) : h . append ( ( f . get ( ( k , ) , K . zero ) % p ) ) return gf_trunc ( h , p )
create a gf(p)[x] polynomial from a dict .