def _resolve_refs(self, rule_map, expr, done):
        """Return an expression with all its lazy references recursively
        resolved.

        Resolve any lazy references in the expression ``expr``, recursing into
        all subexpressions.

        :arg done: The set of Expressions that have already been or are
            currently being resolved, to ward off redundant work and prevent
            infinite recursion for circular refs

        """
        if isinstance(expr, LazyReference):
            label = unicode(expr)
            try:
                reffed_expr = rule_map[label]
            except __HOLE__:
                raise UndefinedLabel(expr)
            return self._resolve_refs(rule_map, reffed_expr, done)
        else:
            if getattr(expr, 'members', ()) and expr not in done:
                # Prevents infinite recursion for circular refs. At worst, one
                # of `expr.members` can refer back to `expr`, but it can't go
                # any farther.
                done.add(expr)
                expr.members = [self._resolve_refs(rule_map, member, done)
                                for member in expr.members]
            return expr
dataset/ETHPy150Open erikrose/parsimonious/parsimonious/grammar.py/RuleVisitor._resolve_refs