def METHOD_NAME(mode):
    def _decode_csv(line):
        features = tf.decode_csv(line, record_defaults=DEFAULTS)
        features = dict(zip(CSV_COLUMNS, features))
        labels = features.pop(LABEL_COLUMN)
        return features, labels
    def _input_fn():
        # use prefix to create filename
        if mode == tf.estimator.ModeKeys.TRAIN:
            prefix = 'train'
            num_epochs = None
            shuffle = True
        else:
            prefix = 'eval'
            num_epochs = 1
            shuffle = False
        filename_pattern = 'gs://{}/preproc/{}*{}*'.format(BUCKET, prefix,
                                                           PATTERN)
        files = tf.data.Dataset.list_files(file_pattern=filename_pattern,
                                           shuffle=shuffle)
        dataset = files.flat_map(
            lambda filename: tf.data.TextLineDataset(filename).map(
                _decode_csv))
        if mode == tf.estimator.ModeKeys.TRAIN:
            dataset = dataset.batch(BATCH_SIZE, drop_remainder=True)
        else:
            dataset = dataset.batch(5012)
        return dataset.repeat(num_epochs).make_one_shot_iterator().get_next()
    return _input_fn