human
Complete this python program:
def examples_reader(data_sources, data_fields_to_features, training, capacity=32, data_items_to_decoders=None, data_items_to_decode=None):
assistant
#Here is the Python program you requested.

    """Reads Examples from data_sources and decodes to Tensors.
    The dictionary data_fields_to_features for an image dataset can be:
    data_fields_to_features = {
    \image/encoded\: tf.FixedLenFeature((), tf.string, default_value=\\),
    \image/format\: tf.FixedLenFeature((), tf.string, default_value=\raw\),
    \image/class/label\: tf.FixedLenFeature(
    [1], tf.int64, default_value=tf.zeros([1], dtype=tf.int64)),
    and for a simple algorithmic dataset with variable-length data it is:
    data_fields_to_features = {
    \inputs\: tf.VarLenFeature(tf.int64),
    \targets\: tf.VarLenFeature(tf.int64),
    The data_items_to_decoders dictionary argument can be left as None if there
    is no decoding to be performed. But, e.g. for images, it should be set so that
    the images are decoded from the features, e.g., for MNIST:
    data_items_to_decoders = {
    \image\: tfexample_decoder.Image(
    image_key = \image/encoded\,
    format_key = \image/format\,
    shape=[28, 28],
    channels=1),
    \label\: tfexample_decoder.Tensor(\image/class/label\),
    These arguments are compatible with the use of tf.contrib.slim.data module,
    see there for more documentation.
    Args:
    data_sources: a list or tuple of sources from which the data will be read,
    for example [/path/to/train@128, /path/to/train2*, /tmp/.../train3*]
    data_fields_to_features: a dictionary from data fields in the data sources
    to features, such as tf.VarLenFeature(tf.int64), see above for examples.
    training: a Boolean, whether to read for training or evaluation.
    capacity: integer, buffer capacity; set to 2 * max_batch_size or more.
    data_items_to_decoders: a dictionary mapping data items (that will be
    in the returned result) to decoders that will decode them using features
    defined in data_fields_to_features; see above for examples. By default
    (if this is None), we grab the tensor from every feature.
    data_items_to_decode: a subset of data items that will be decoded;
    by default (if this is None),..."""
    def decode_record(record):
        'Serialized    Example    to    dict    of    <feature    name,    Tensor>.'
        example_serialized = record
        item_decoders = data_items_to_decoders
        if (item_decoders is None):
            item_decoders = {field: tf.contrib.slim.tfexample_decoder.Tensor(field) for field in data_fields_to_features}
        decoder = tf.contrib.slim.tfexample_decoder.TFExampleDecoder(data_fields_to_features, item_decoders)
        decode_items = data_items_to_decode
        if (decode_items is None):
            decode_items = list(item_decoders)
        decoded = decoder.decode(example_serialized, items=decode_items)
        return dict(zip(decode_items, decoded))
    with tf.name_scope('examples_in'):
        data_files = tf.contrib.slim.parallel_reader.get_data_files(data_sources)
        num_readers = min((4 if training else 1), len(data_files))
        (_, example_serialized) = tf.contrib.slim.parallel_reader.parallel_read(data_sources, tf.TFRecordReader, num_epochs=(None if training else 1), shuffle=training, capacity=(2 * capacity), min_after_dequeue=capacity, num_readers=num_readers)
        return decode_record(example_serialized)