def get_next_mangled_name(self):
        while True:
            mangled = self.base54.next()

            # case 1
            ancestor = self._get_scope_with_mangled(mangled)
            if (ancestor is not None
                and self.refs.get(ancestor.rev_mangled[mangled]) is ancestor
                ):
                continue

            # case 2
            ancestor = self._get_scope_with_symbol(mangled)
            if (ancestor is not None
                and self.refs.get(mangled) is ancestor
                and mangled not in ancestor.mangled
                ):
                continue

            # make sure a new mangled name is not a reserved word
            if mangled.upper() in Lexer.keywords:
                continue

            return mangled
1. Do not shadow a mangled name from a parent scope
dataset/ETHPy150Open rspivak/slimit/src/slimit/scope.py/Scope.get_next_mangled_name