'Extract JPEG thumbnail.
(Thankfully the JPEG data is stored as a unit.)'

def extract_jpeg_thumbnail(self):

    thumb_offset = self.tags.get('Thumbnail    JPEGInterchangeFormat')
    if thumb_offset:
        self.file.seek((self.offset + thumb_offset.values[0]))
        size = self.tags['Thumbnail    JPEGInterchangeFormatLength'].values[0]
        self.tags['JPEGThumbnail'] = self.file.read(size)
    if ('JPEGThumbnail' not in self.tags):
        thumb_offset = self.tags.get('MakerNote    JPEGThumbnail')
        if thumb_offset:
            self.file.seek((self.offset + thumb_offset.values[0]))
            self.tags['JPEGThumbnail'] = self.file.read(thumb_offset.field_length)
