def eliminateUnused(tree): syms = du.UseFinder().run(tree) unneeded = lambda sym: ismeta(sym) or pat.isauxmap(sym) and sym not in syms du.EliminateUnused().run(tree, unneeded)
def ismemberaux(auxsym): return pat.isauxmap(auxsym) and ismember(auxsym.host)
def isfieldaux(auxsym): return pat.isauxmap(auxsym) and isfield(auxsym.host)
def isforward(auxsym): return (pat.isauxmap(auxsym) and dha.isBoundPat(auxsym.pat.elts[0]) and dha.isUnboundPat(auxsym.pat.elts[1]))