def dump(stuff):
    if (not (isinstance(stuff, str) or isinstance(stuff, int)
             or isinstance(stuff, list) or isinstance(stuff, dict)
             or isinstance(stuff, tuple) or isinstance(stuff, float)
             or isinstance(stuff, complex))):

        buf = ['%r : %s' % (stuff, str(stuff))]

        for name in dir(stuff):
            attr = getattr(stuff, name)

            if not hasattr(attr, '__call__'):
                buf.append('  -> %s : %s' % (name, attr))

        print('\n'.join(buf) + '\n')

    else:
        import pprint
        pp = pprint.PrettyPrinter(indent=4)
        pp.pprint(stuff)


def cleandir(path):
    import os

    for root, dirs, files in os.walk(path, topdown=False):
        for name in files:
            os.remove(os.path.join(root, name))

        for name in dirs:
            os.rmdir(os.path.join(root, name))


def init_test_suite():
    import inspect
    import unittest

    _globals = inspect.stack()[1][0].f_globals

    def init():
        nonlocal _globals

        suite = unittest.TestSuite()
        for name, attr in _globals.items():
            if isinstance(attr, type) and issubclass(attr, unittest.TestCase):
                suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(attr))

        _globals = None
        return suite

    _globals['suite'] = init

@@ -1344,8 +1344,487 @@
  = init%0A
+%0A%0Adef dump_code_context(filename, lineno, dump_range=4):%0A    with open(filename, 'r') as file:%0A        source = file.read().split('%5Cn')%0A%0A    source_snippet = ''%0A    for j in range(max(0, lineno-dump_range), min(len(source), lineno+dump_range)):%0A        line = source%5Bj%5D + '%5Cn'%0A%0A        if j == lineno:%0A            line = ' %3E ' + line%0A        else:%0A            line = ' %7C ' + line%0A%0A        line = '%7B0:6%7D'.format(j) + line%0A        source_snippet += line%0A%0A    return source_snippet%0A

Implement dump_code_context() helper function