def dup_decompose(f, K):
 F = []
 while True:
  result = _dup_decompose(f, K)
  if (result is not None):
   (f, h) = result
   F = ([h] + F)
  else:
   break
 return ([f] + F)

def dup_decompose ( f , K ) : F = [ ] while True : result = _dup_decompose ( f , K ) if ( result is not None ) : ( f , h ) = result F = ( [ h ] + F ) else : break return ( [ f ] + F )
computes functional decomposition of f in k[x] .