def dmp_validate(f, K=None):
 levels = _rec_validate(f, f, 0, K)
 u = levels.pop()
 if (not levels):
  return (_rec_strip(f, u), u)
 else:
  raise ValueError('invalid data structure for a multivariate polynomial')

def dmp_validate ( f , K = None ) : levels = _rec_validate ( f , f , 0 , K ) u = levels . pop ( ) if ( not levels ) : return ( _rec_strip ( f , u ) , u ) else : raise ValueError ( 'invalid data structure for a multivariate polynomial' )
return the number of levels in f and recursively strip it .