<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def purge_all(user=None, fast=False):
 """ Remove all calculations of the given user """

    user = user or getpass.getuser()
    if os.path.exists(datadir):
        if fast:
            shutil.rmtree(datadir)
            print('Removed %s' % datadir)
        else:
            for fname in os.listdir(datadir):
                mo = re.match('calc_(\d+)\.hdf5', fname)
                if mo is not None:
                    calc_id = int(mo.group(1))
                    purge_one(calc_id, user)