def_rec_validate(f,g,i,K):"""Recursive helper for :func:`dmp_validate`."""iftype(g)isnotlist:ifKisnotNoneandnotK.of_type(g):raiseTypeError("%s in %s in not of type %s"%(g,f,K.dtype))returnset([i-1])elifnotg:returnset([i])else:j,levels=i+1,set([])forcing:levels|=_rec_validate(f,c,i+1,K)returnlevelsdef_rec_strip(g,v):"""Recursive helper for :func:`_rec_strip`."""ifnotv:returndup_strip(g)w=v-1returndmp_strip([_rec_strip(c,w)forcing],v)