human
I wrote the below code

    _str = (str if (sys.version_info[0] < 3) else (lambda x: str(x, 'cp1252')))
    def read_string(data, byteorder):
        return _str(stripnull(data[(0 if (byteorder == '<') else 1)::2]))
    def read_double(data, byteorder):
        return struct.unpack((byteorder + ('d' * (len(data) // 8))), data)
    def read_bytes(data, byteorder):
        return numpy.fromstring(data, 'uint8')
    metadata_types = {'info': ('info', read_string), 'labl': ('labels', read_string), 'rang': ('ranges', read_double), 'luts': ('luts', read_bytes), 'roi    ': ('roi', read_bytes), 'over': ('overlays', read_bytes)}
    metadata_types.update(dict(((k[::(-1)], v) for (k, v) in metadata_types.items())))
    if (not bytecounts):
        raise ValueError('no    ImageJ    metadata')
    if (not (data[:4] in ('IJIJ', 'JIJI'))):
        raise ValueError('invalid    ImageJ    metadata')
    header_size = bytecounts[0]
    if ((header_size < 12) or (header_size > 804)):
        raise ValueError('invalid    ImageJ    metadata    header    size')
    ntypes = ((header_size - 4) // 8)
    header = struct.unpack((byteorder + ('4sI' * ntypes)), data[4:(4 + (ntypes * 8))])
    pos = (4 + (ntypes * 8))
    counter = 0
    result = {}
    for (mtype, count) in zip(header[::2], header[1::2]):
        values = []
        (name, func) = metadata_types.get(mtype, (_str(mtype), read_bytes))
        for _ in range(count):
            counter += 1
            pos1 = (pos + bytecounts[counter])
            values.append(func(data[pos:pos1], byteorder))
            pos = pos1
        result[name.strip()] = (values[0] if (count == 1) else values)
    return result

What's a good function header?
assistant
#Here's a good function header.

def imagej_metadata(data, bytecounts, byteorder):