<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def segment_mask(self, segnum):
 """ Returns a binary image of just the segment corresponding to the given number. Parameters segnum : int the number of the segment to generate a mask for Returns ------- :obj:`BinaryImage` binary image data """

        binary_data = np.zeros(self.shape)
        binary_data[self.data == segnum] = BINARY_IM_MAX_VAL
        return BinaryImage(binary_data.astype(np.uint8), frame=self.frame)