'Compare data read from the file with the expected data for this
particular mime type register.
:param data: Data read from the file.'

def compare(self, data):

    try:
        if (self.type == 'string'):
            c = ''
            s = ''
            for i in range(0, (len(self.value) + 1)):
                if ((i + self.offset) > (len(data) - 1)):
                    break
                s = (s + c)
                [c] = struct.unpack('c', data[(self.offset + i)])
            data = s
        elif (self.type == 'short'):
            [data] = struct.unpack('h', data[self.offset:(self.offset + 2)])
        elif (self.type == 'leshort'):
            [data] = struct.unpack('<h', data[self.offset:(self.offset + 2)])
        elif (self.type == 'beshort'):
            [data] = struct.unpack('>H', data[self.offset:(self.offset + 2)])
        elif (self.type == 'long'):
            [data] = struct.unpack('l', data[self.offset:(self.offset + 4)])
        elif (self.type == 'lelong'):
            [data] = struct.unpack('<l', data[self.offset:(self.offset + 4)])
        elif (self.type == 'belong'):
            [data] = struct.unpack('>l', data[self.offset:(self.offset + 4)])
        else:
            pass
    except Exception:
        return None
    return self.test(data)
