<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_notebook_node(self, nb, resources=None, **kw):
 """Create a Metatab package from a notebook node """


        nb_copy = copy.deepcopy(nb)

        # The the package name and directory, either from the inlined Metatab doc,
        # or from the config

        try:
            self.output_dir = self.get_output_dir(nb)
        except NotebookError as e:
            # Notebook probably lacks a metatab doc.
            self.log.fatal(e)
            sys.exit(1)

        assert self.output_dir

        resources = self._init_resources(resources)

        resources['outputs'] = {}

        if 'language' in nb['metadata']:
            resources['language'] = nb['metadata']['language'].lower()

        # Do any other configured preprocessing
        nb_copy, resources = self._preprocess(nb_copy, resources)

        # The Notebook can set some terms with tags
        self.extra_terms = self.extract_terms(nb_copy)

        # Clear the output before executing
        self.clear_output(nb_copy)

        nb_copy, resources = self.exec_notebook(nb_copy, resources, self.notebook_dir)

        eld = ExtractLibDirs()
        eld.preprocess(nb_copy, {})

        self.lib_dirs = eld.lib_dirs

        efm = ExtractFinalMetatabDoc()
        efm.preprocess(nb_copy, {})

        if not efm.doc:
            raise MetapackError("No metatab doc")

        self.doc = efm.doc

        for section, term, value in self.extra_terms:
            self.doc[section].get_or_new_term(term, value)

        nb, _ = RemoveMetatab().preprocess(nb, {})

        resources['outputs']['notebooks/{}.ipynb'.format(self.package_name)] = nbformat.writes(nb).encode('utf-8')

        return efm.doc.as_csv(), resources