<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_cloud_masks(self, threshold=None, non_valid_value=False):
 """ The binary cloud mask is computed on the fly. Be cautious. The pixels without valid data are assigned non_valid_value. :param threshold: A float from [0,1] specifying threshold :type threshold: float :param non_valid_value: Value which will be assigned to pixels without valid data :type non_valid_value: int in range `[-254, 255]` :return: Binary cloud masks of shape `(times, height, width)` and `dtype=numpy.int8` :rtype: numpy.ndarray """

        self.get_probability_masks()

        cloud_masks = self.cloud_detector.get_mask_from_prob(self.probability_masks, threshold)
        cloud_masks[~self.valid_data] = non_valid_value

        return cloud_masks