code: def mask_loss(loss, mask_value=MASK_VALUE):
      
      loss_fn = kloss.deserialize(loss)
  
      def masked_loss_fn(y_true, y_pred):
          # currently not suppoerd with NA's:
          #  - there is no K.is_nan impolementation in keras.backend
          #  - https://github.com/fchollet/keras/issues/1628
          mask = K.cast(K.not_equal(y_true, mask_value), K.floatx())
  
          # we divide by the mean to correct for the number of done loss evaluations
          return loss_fn(y_true * mask, y_pred * mask) / K.mean(mask)
  
      masked_loss_fn.__name__ = loss + "_masked"
      return masked_loss_fn
docs: Generates a new loss function that ignores values where `y_true == mask_value`.
  
      # Arguments
          loss: str; name of the keras loss function from `keras.losses`
          mask_value: int; which values should be masked
  
      # Returns
          function; Masked version of the `loss`
  
      # Example
          ```python
                  categorical_crossentropy_masked = mask_loss("categorical_crossentropy")
          ```