<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def focus_loss(labels, probs, loss, gamma):
 """ Calculate the alpha balanced focal loss. See the focal loss paper: "Focal Loss for Dense Object Detection" [by Facebook AI Research] :param gamma: The focus parameter. :return: A tensor representing the weighted cross entropy. """

    with tf.variable_scope("focus_loss"):
        # Compute p_t that is used in paper.
        # FIXME is it possible that the 1-p term does not make any sense?
        p_t = tf.reduce_sum(probs * labels, axis=-1)# + tf.reduce_sum((1.0 - probs) * (1.0 - labels), axis=-1)

        focal_factor = tf.pow(1.0 - p_t, gamma) if gamma > 0 else 1  # Improve stability for gamma = 0
        return tf.stop_gradient(focal_factor) * loss