def stateful_flags(rep_restart_wait=None, quorum_loss_wait=None,
                   standby_replica_keep=None):
    """Calculate an integer representation of flag arguments for stateful
    services"""

    flag_sum = 0
    if rep_restart_wait is not None:
        flag_sum += 1
    if quorum_loss_wait is not None:
        flag_sum += 2
    if standby_replica_keep is not None:
        flag_sum += 4
    return flag_sum