def _read_block(fp, encoding):
    """
    Reads single image resource block. Such blocks contain non-pixel data
    for the images (e.g. pen tool paths).
    """
    sig = fp.read(4)
    if not sig in [b'8BIM', b'MeSa']:
        raise Error("Invalid resource signature (%r)" % sig)

    resource_id = read_fmt("H", fp)[0]
    name = read_pascal_string(fp, encoding, 2)

    data_size = pad(read_fmt("I", fp)[0], 2)
    data = fp.read(data_size)

    return ImageResource(resource_id, name, data)
dataset/ETHPy150Open psd-tools/psd-tools/src/psd_tools/reader/image_resources.py/_read_block/original