def decode(data):
    fp = io.BytesIO(data)
    layers = []
    while True:
        start = fp.tell()
        length_buf = fp.read(8)
        if not length_buf:
            break   # end of file
        length = struct.unpack(str('>Q'), length_buf)[0]
        liFD, version = read_fmt('4s I', fp)
        if liFD != b'liFD':
            warnings.warn('unknown layer type')
            break
        unique_id = read_pascal_string(fp, 'ascii')
        filename = read_unicode_string(fp)
        filetype, creator, filelength, have_file_open_descriptor = read_fmt('4s 4s Q B', fp)
        filetype = str(filetype)
        if have_file_open_descriptor:
            # Does not seem to contain any useful information
            undocumented_integer = read_fmt("I", fp)
            file_open_descriptor = decode_descriptor(None, fp)
        else:
            file_open_descriptor = None
        decoded = fp.read(filelength)
        # Undocumented extra field
        if version == 5:
            uuid = read_unicode_string(fp)
        else:
            uuid = None
        layers.append(
            LinkedLayer(version, unique_id, filename, filetype, file_open_descriptor,
                        creator, decoded, uuid)
        )
        # Gobble up anything that we don't know how to decode
        expected_position = start + 8 + length      # first 8 bytes contained the length
        if expected_position != fp.tell():
            warnings.warn('skipping over undocumented additional fields')
            fp.read(expected_position - fp.tell())
        # Each layer is padded to start and end at 4-byte boundary
        pad = -fp.tell() % 4
        fp.read(pad)
    return LinkedLayerCollection(layers)
Like dict.__delitem__() but does not raise KeyError for missing values.
dataset/ETHPy150Open psd-tools/psd-tools/src/psd_tools/decoder/linked_layer.py/decode--crossover with--dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/dep/counter.py/Counter.__delitem__