Checks the upload directory to see if the uploaded file would exceed
    the total disk allotment. Meant as a quick and dirty example.

def check_disk_usage(filehandle, meta):
    """Checks the upload directory to see if the uploaded file would exceed
    the total disk allotment. Meant as a quick and dirty example.
    """
    # limit it at twenty kilobytes if no default is provided
    MAX_DISK_USAGE = current_app.config.get('MAX_DISK_USAGE', 20 * 1024)
    CURRENT_USAGE = really_bad_du(current_app.config['UPLOAD_PATH'])
    filehandle.seek(0, os.SEEK_END)

    if CURRENT_USAGE + filehandle.tell() > MAX_DISK_USAGE:
        filehandle.close()
        raise UploadError("Upload exceeds allotment.")
    filehandle.seek(0)
    return filehandle