def generate_image(adv_object: Callable, shape: tuple) -> np.ndarray:
        """
        Generate image of the adversarial object.

        :param adv_object: Adversarial object.
        :param shape: Shape of the desired image.
        :returns: Image of the adversarial object.
        """
        laser_image = np.zeros(shape)
        if laser_image.ndim == 3 and laser_image.shape[2] == 3:
            for i in range(shape[0]):
                for j in range(shape[1]):
                    rgb = adv_object(i, j)
                    for chan in range(3):
                        laser_image[i, j, chan] = np.clip(rgb[chan], 0, 1)
        elif laser_image.ndim == 2:
            for i in range(shape[0]):
                for j in range(shape[1]):
                    rgb = np.mean(adv_object(i, j))
                    laser_image[i, j] = np.clip(rgb, 0, 1)

        return laser_image

        Generate image of the adversarial object.

        :param adv_object: Adversarial object.
        :param shape: Shape of the desired image.
        :returns: Image of the adversarial object.
        
art/attacks/evasion/laser_attack/utils.py