def METHOD_NAME(task_id):
    task_to_delete = Task.query.filter_by(id=task_id).first()
    db.session.delete(task_to_delete)
    try:
        db.session.commit()
        return True
    except IntegrityError:
        return False