def METHOD_NAME(sample, is_training):
    image_array = sample.reshape(IMAGE_DEPTH, IMAGE_SIZE, IMAGE_SIZE)
    rgb_array = np.transpose(image_array, (1, 2, 0))
    img = Image.fromarray(rgb_array, 'RGB')
    if is_training:
        # pad, ramdom crop, random_flip_left_right
        img = ImageOps.expand(img, (4, 4, 4, 4), fill=0)
        left_top = np.random.randint(8, size=2)
        img = img.crop((left_top[1], left_top[0], left_top[1] + IMAGE_SIZE,
                        left_top[0] + IMAGE_SIZE))
        if np.random.randint(2):
            img = img.transpose(Image.FLIP_LEFT_RIGHT)
    img = np.array(img).astype(np.float32)
    img_float = img / 255.0
    img = (img_float - CIFAR_MEAN) / CIFAR_STD
    if is_training and cutout:
        center = np.random.randint(IMAGE_SIZE, size=2)
        offset_width = max(0, center[0] - cutout_length // 2)
        offset_height = max(0, center[1] - cutout_length // 2)
        target_width = min(center[0] + cutout_length // 2, IMAGE_SIZE)
        target_height = min(center[1] + cutout_length // 2, IMAGE_SIZE)
        for i in range(offset_height, target_height):
            for j in range(offset_width, target_width):
                img[i][j][:] = 0.0
    img = np.transpose(img, (2, 0, 1))
    return img