def failover_group_failover(client, resource_group_name, server_name,
    failover_group_name, allow_data_loss=False):
    """
    Failover a failover group.
    """
    failover_group = client.get(resource_group_name=resource_group_name,
        server_name=server_name, failover_group_name=failover_group_name)
    if failover_group.replication_role == 'Primary':
        return
    if allow_data_loss:
        failover_func = client.force_failover_allow_data_loss
    else:
        failover_func = client.failover
    return failover_func(resource_group_name=resource_group_name,
        server_name=server_name, failover_group_name=failover_group_name)
