human
I wrote the below code

    def _toTFExample(iter):
        import tensorflow as tf
        float_dtypes = ['float', 'double']
        int64_dtypes = ['boolean', 'tinyint', 'smallint', 'int', 'bigint', 'long']
        bytes_dtypes = ['string']
        float_list_dtypes = ['array<float>', 'array<double>']
        int64_list_dtypes = ['array<boolean>', 'array<tinyint>', 'array<smallint>', 'array<int>', 'array<bigint>', 'array<long>']
        def _toTFFeature(name, dtype, row):
            feature = None
            if (dtype in float_dtypes):
                feature = (name, tf.train.Feature(float_list=tf.train.FloatList(value=[row[name]])))
            elif (dtype in int64_dtypes):
                feature = (name, tf.train.Feature(int64_list=tf.train.Int64List(value=[row[name]])))
            elif (dtype in bytes_dtypes):
                feature = (name, tf.train.Feature(bytes_list=tf.train.BytesList(value=[str(row[name])])))
            elif (dtype in float_list_dtypes):
                feature = (name, tf.train.Feature(float_list=tf.train.FloatList(value=row[name])))
            elif (dtype in int64_list_dtypes):
                feature = (name, tf.train.Feature(int64_list=tf.train.Int64List(value=row[name])))
            else:
                raise Exception('Unsupported    dtype:    {0}'.format(dtype))
            return feature
        results = []
        for row in iter:
            features = dict([_toTFFeature(name, dtype, row) for (name, dtype) in dtypes])
            example = tf.train.Example(features=tf.train.Features(feature=features))
            results.append(example.SerializeToString())
        return results
    return _toTFExample

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

def toTFExample(dtypes):