<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cell_exception(self, cell, cell_index=None, **kwargs):
 """ Set metadata when an exception is raised. Called by engines when an exception is raised within a notebook to set the metadata on the notebook indicating the location of the failure. """

        cell.metadata.papermill['exception'] = True
        cell.metadata.papermill['status'] = self.FAILED
        self.nb.metadata.papermill['exception'] = True