How to wipe all the contents of RP2040 in micropython

import os


def _delete_all(directory='.', keep_this=True):
    try:
        import machine
    except:
        # not a micropython board so exit gracefully
        print('Not a micro-python board! Leaving it well alone.')
        return
    for fi in os.ilistdir(directory):
        fn, ft = fi[0:2] # can be 3 or 4 items returned!
        if keep_this and fn == '_nuke.py':
            continue
        fp = '%s/%s' % (directory, fn)
        print('removing %s' % fp) 
        if ft == 0x8000:
            os.remove(fp)
        else:
            _delete_all(fp)
            os.rmdir(fp)


_delete_all()