def size_on_copy(root="."):
    """Return the size of the experiment directory in bytes, excluding any
    files and directories which would be excluded on copy.
    """
    total_size = 0
    exclusions = exclusion_policy()
    for dirpath, dirnames, filenames in os.walk(root, topdown=True):
        current_exclusions = exclusions(dirpath, os.listdir(dirpath))
        # Modifying dirnames in-place will prune the subsequent files and
        # directories visited by os.walk. This is only possible when
        # topdown = True
        dirnames[:] = [d for d in dirnames if d not in current_exclusions]
        legit_files = [f for f in filenames if f not in current_exclusions]
        for f in legit_files:
            fp = os.path.join(dirpath, f)
            total_size += os.path.getsize(fp)
    return total_size
Return the size of the experiment directory in bytes, excluding any
    files and directories which would be excluded on copy.