code: def _mask_relevancy_matrix(relevancy_matrix, mask_lt, mask_rt):
      """
      Mask relevancy matrix.
  
      :param relevancy_matrix: [b, len_rt, len_lt]
      :param mask_lt: [b, len_lt]
      :param mask_rt: [b, len_rt]
      :return: masked_matrix: [b, len_rt, len_lt]
      """
      if mask_lt is not None:
          relevancy_matrix = relevancy_matrix * tf.expand_dims(
              mask_lt, 1
          )
      relevancy_matrix = relevancy_matrix * tf.expand_dims(mask_rt, 2)
      return relevancy_matrix
  
imports: import tensorflow
  from keras import backend
  from keras.engine import Layer
  from matchzoo.contrib.layers.attention_layer import AttentionLayer
label_desc: Use image node_id 7 for calling a global function with example usage: _mask_relevancy_matrix(relevancy_matrix, mask_lt, mask_rt) and returns: relevancy_matrix