<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def mask_and_mean_loss(input_tensor, binary_tensor, axis=None):
 """ Mask a loss by using a tensor filled with 0 or 1 and average correctly. :param axis: The dimensions to reduce. If None (the default), reduces all dimensions. Must be in the range [-rank(input_tensor), rank(input_tensor)). """

    return mean_on_masked(mask_loss(input_tensor, binary_tensor), binary_tensor, axis=axis)