Get image level.

        Parameters
        ----------
        img : `PIL.Image`
            Input image.
        level : `int`
            Level number.

        Returns
        -------
        `PIL.Image`
            Converted image.

def level(self, img, level):
        """Get image level.

        Parameters
        ----------
        img : `PIL.Image`
            Input image.
        level : `int`
            Level number.

        Returns
        -------
        `PIL.Image`
            Converted image.
        """
        if level < self.levels - 1:
            width, height = img.size
            scale = reduce(lambda x, y: x * y,
                           islice(self.level_scale, level, self.levels))
            img = img.resize((width // scale, height // scale), self.scale)
        return img