<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def thumbnail(self):
 """ Returns a thumbnail image in PIL.Image. When the file does not contain an embedded thumbnail image, returns None. """

        if 'THUMBNAIL_RESOURCE' in self.image_resources:
            return pil_io.convert_thumbnail_to_pil(
                self.image_resources.get_data('THUMBNAIL_RESOURCE')
            )
        elif 'THUMBNAIL_RESOURCE_PS4' in self.image_resources:
            return pil_io.convert_thumbnail_to_pil(
                self.image_resources.get_data('THUMBNAIL_RESOURCE_PS4'), 'BGR'
            )
        return None