<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _extract_namespace_ast_node(self, desc):
 """ Checks that the namespace is declared first in the spec, and that only one namespace is declared. Args: desc (List[stone.stone.parser.ASTNode]):
 All AST nodes in a spec file in the order they were defined. Return: stone.frontend.ast.AstNamespace: The namespace AST node. """

        if len(desc) == 0 or not isinstance(desc[0], AstNamespace):
            if self._debug:
                self._logger.info('Description: %r', desc)
            raise InvalidSpec('First declaration in a stone must be '
                              'a namespace. Possibly caused by preceding '
                              'errors.', desc[0].lineno, desc[0].path)
        for item in desc[1:]:
            if isinstance(item, AstNamespace):
                raise InvalidSpec('Only one namespace declaration per file.',
                                  item[0].lineno, item[0].path)
        return desc.pop(0)