def stateful_flags(rep_restart_wait=None, quorum_loss_wait=None,
    standby_replica_keep=None, service_placement_time=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
    if service_placement_time is not None:
        flag_sum += 8
    return flag_sum
