def _lookup_in_all_namespaces(self, symbol):
namespace = self.namespaces<EOL>namespace_stack = []<EOL>for current in symbol.namespace_stack:<EOL><INDENT>namespace = namespace.get(current)<EOL>if namespace is None or not isinstance(namespace, dict):<EOL><INDENT>break<EOL><DEDENT>namespace_stack.append(namespace)<EOL><DEDENT>for namespace in reversed(namespace_stack):<EOL><INDENT>try:<EOL><INDENT>return self._lookup_namespace(symbol, namespace)<EOL><DEDENT>except Error:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return None<EOL>
Helper for lookup_symbol that looks for symbols in all namespaces.

        Args:
          symbol: Symbol