def prepare_cell(self, cell):
        cell = dict(cell)
        if 'metadata' in cell:
            del cell['metadata']
        if 'text' in cell:
            # don't match object's id; also happens to fix incompatible
            # results between IPython2 and IPython3 (which prints "object"
            # instead of "at [id]"
            cell['text'] = re.sub('at 0x[0-9a-f]+', 'object', cell['text'])
        if 'traceback' in cell:
            trsub = lambda l: re.sub('\x1b\\[[01];\\d\\dm', '', l)
            cell['traceback'] = [trsub(line) for line in cell['traceback']]
            # rejoin lines, so it's one string to compare
            cell['traceback'] = u'\n'.join(cell['traceback'])
            # Python 3 describes a ZeroDivisionError differently.
            # We change the Python 2 wording to the Python 3 wording.
            cell['evalue'] = re.sub(
                'integer division or modulo by zero',
                'division by zero',
                cell['evalue']
            )
            cell['traceback'] = re.sub(
                'integer division or modulo by zero',
                'division by zero',
                cell['traceback']
            )
        return cell
dataset/ETHPy150Open paulgb/runipy/test_runipy.py/TestRunipy.prepare_cell/original