def get_or_delete_A_data(a_num=None, username=None, delete=False):
    "回答データをデータベースから、削除or取り出し"
    ret, q, root = get_A_data(a_num=a_num, username=username)
    if not ret:
        return False, q # q==msg
    if q is None:
        return ret, []
    result = []
    if a_num is None: # a_num==Noneのとき、データが複数個になる
        q2 = q
    else:
        q2 = [q]
    if delete:
        get_or_delete_A_info(a_num=a_num, username=username, delete=True)
        for i in q2:
            result.append("DELETE A%d" % i.anum)
            i.key.delete()
    else: # GETの場合
        for i in q2:
            result.append("GET A%d" % i.anum)
            result.append(i.text)
    return True, result