def METHOD_NAME(input_image, mask, ff_flag=False, image=False):
    """ Apply a mask to the given image array or FF file. 
    Keyword arguments:
        image: [bool] If True, the image for the mask was given, and not the MaskStructure instance.
    """
    if mask is None:
        return input_image
    # Apply masking to an FF file
    if ff_flag:
        input_image.maxpixel = maskImage(input_image.maxpixel, mask, image=image)
        input_image.avepixel = maskImage(input_image.avepixel, mask, image=image)
        input_image.stdpixel = maskImage(input_image.stdpixel, mask, image=image)
        #input_image.maxframe = maskImage(input_image.maxframe, mask)
        return input_image
    # Apply the mask to a regular image array
    else:
        return maskImage(input_image, mask, image=image)