human
I wrote the below code

    cpb = get_caffe_pb()
    lmdb_data = LMDBData(lmdb_path, shuffle, keys)
    def decoder(k, v):
        try:
            datum = cpb.Datum()
            datum.ParseFromString(v)
            img = np.fromstring(datum.data, dtype=np.uint8)
            img = img.reshape(datum.channels, datum.height, datum.width)
        except Exception:
            log_once('Cannot    read    key    {}'.format(k), 'warn')
            return None
        return [img.transpose(1, 2, 0), datum.label]
    logger.warn("Caffe    LMDB    format    doesn't    store    jpeg-compressed    images,                                    it's    not    recommended    due    to    its    inferior    performance.")
    return LMDBDataDecoder(lmdb_data, decoder)

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

def CaffeLMDB(lmdb_path, shuffle=True, keys=None):