<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def otsu_segmentation(image, k, mask=None):
 """ Otsu image segmentation This is a very fast segmentation algorithm good for quick explortation, but does not return probability maps. ANTsR function: `thresholdImage(image, 'Otsu', k)` Arguments --------- image : ANTsImage input image k : integer integer number of classes. Note that a background class will be added to this, so the resulting segmentation will have k+1 unique values. mask : ANTsImage segment inside this mask Returns ------- ANTsImage Example ------- """

    if mask is not None:
        image = image.mask_image(mask)

    seg = image.threshold_image('Otsu', k)
    return seg