<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def convert_binarized_mnist(directory, output_directory, output_filename='binarized_mnist.hdf5'):
 """Converts the binarized MNIST dataset to HDF5. Converts the binarized MNIST dataset used in R. Salakhutdinov's DBN paper [DBN] to an HDF5 dataset compatible with :class:`fuel.datasets.BinarizedMNIST`. The converted dataset is saved as 'binarized_mnist.hdf5'. This method assumes the existence of the files `binarized_mnist_{train,valid,test}.amat`, which are accessible through Hugo Larochelle's website [HUGO]. .. [DBN] Ruslan Salakhutdinov and Iain Murray, *On the Quantitative Analysis of Deep Belief Networks*, Proceedings of the 25th international conference on Machine learning, 2008, pp. 872-879. Parameters directory : str Directory in which input files reside. output_directory : str Directory in which to save the converted dataset. output_filename : str, optional Name of the saved dataset. Defaults to 'binarized_mnist.hdf5'. Returns ------- output_paths : tuple of str Single-element tuple containing the path to the converted dataset. """

    output_path = os.path.join(output_directory, output_filename)
    h5file = h5py.File(output_path, mode='w')

    train_set = numpy.loadtxt(
        os.path.join(directory, TRAIN_FILE)).reshape(
            (-1, 1, 28, 28)).astype('uint8')
    valid_set = numpy.loadtxt(
        os.path.join(directory, VALID_FILE)).reshape(
            (-1, 1, 28, 28)).astype('uint8')
    test_set = numpy.loadtxt(
        os.path.join(directory, TEST_FILE)).reshape(
            (-1, 1, 28, 28)).astype('uint8')
    data = (('train', 'features', train_set),
            ('valid', 'features', valid_set),
            ('test', 'features', test_set))
    fill_hdf5_file(h5file, data)
    for i, label in enumerate(('batch', 'channel', 'height', 'width')):
        h5file['features'].dims[i].label = label

    h5file.flush()
    h5file.close()

    return (output_path,)