<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_valid(self, values, flag=None):
 """Check if the data contains any non-valid status information Parameters values: pycbc.types.Array Array of status information flag: str, optional Override the default valid mask with a user defined mask. Returns ------- status: boolean Returns True if all of the status information if valid, False if any is not. """

        if self.valid_on_zero:
            valid = values.numpy() == 0
        else:
            if flag is None:
                flag = self.valid_mask
            valid = numpy.bitwise_and(values.numpy(), flag) == flag
        return bool(numpy.all(valid))