'returns segments of blob reassembled into a string
if next segment offset is not the expected offset
errorHandler(blob,expected,offset) will be called
blob is a reference to the blob
if expected<offset, data is missing
if expected>offset, data is overlapping
else a KeyError will be raised.
if the exception is passed and data is missing
if padding != None it will be used to fill the gap
if segment overlaps existing data
new data is kept if overlap=True
existing data is kept if overlap=False
caller: a ref to the calling object, passed to errorhandler
dup: how to handle duplicate segments:
0: use first segment seen
-1 (default): use last segment seen
changing duplicate segment handling to always take largest segment'

def data(self, errorHandler=None, padding=None, overlap=True, caller=None):

    d = ''
    nextoffset = self.startoffset
    for segoffset in sorted(self.segments.iterkeys()):
        if (segoffset != nextoffset):
            if errorHandler:
                if (not errorHandler(blob=self, expected=nextoffset, offset=segoffset, caller=caller)):
                    continue
            elif (segoffset > nextoffset):
                if (padding is not None):
                    if len(padding):
                        d += (str(padding) * (segoffset - nextoffset))
                else:
                    raise KeyError(nextoffset)
            elif ((segoffset < nextoffset) and (not overlap)):
                continue
        seg = ''
        for x in self.segments[segoffset]:
            if (len(x) > len(seg)):
                seg = x
        nextoffset = ((segoffset + len(seg)) & self.MAX_OFFSET)
        d = ((d[:(segoffset - self.startoffset)] + seg) + d[(nextoffset - self.startoffset):])
    return d
