def _rec_validate(f, g, i, K):
 if (type(g) is not list):
  if ((K is not None) and (not K.of_type(g))):
   raise TypeError(('%s in %s in not of type %s' % (g, f, K.dtype)))
  return set([(i - 1)])
 elif (not g):
  return set([i])
 else:
  (j, levels) = ((i + 1), set([]))
  for c in g:
   levels |= _rec_validate(f, c, (i + 1), K)
  return levels

def _rec_validate ( f , g , i , K ) : if ( type ( g ) is not list ) : if ( ( K is not None ) and ( not K . of_type ( g ) ) ) : raise TypeError ( ( '%s in %s in not of type %s' % ( g , f , K . dtype ) ) ) return set ( [ ( i - 1 ) ] ) elif ( not g ) : return set ( [ i ] ) else : ( j , levels ) = ( ( i + 1 ) , set ( [ ] ) ) for c in g : levels |= _rec_validate ( f , c , ( i + 1 ) , K ) return levels
recursive helper for :func:dmp_validate .