<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_celeba(which_format, directory, output_directory, output_filename=None):
 """Converts the CelebA dataset to HDF5. Converts the CelebA dataset to an HDF5 dataset compatible with :class:`fuel.datasets.CelebA`. The converted dataset is saved as 'celeba_aligned_cropped.hdf5' or 'celeba_64.hdf5', depending on the `which_format` argument. Parameters which_format : str Either 'aligned_cropped' or '64'. Determines which format to convert to. 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 'celeba_aligned_cropped.hdf5' or 'celeba_64.hdf5', depending on `which_format`. Returns ------- output_paths : tuple of str Single-element tuple containing the path to the converted dataset. """

    if which_format not in ('aligned_cropped', '64'):
        raise ValueError("CelebA format needs to be either "
                         "'aligned_cropped' or '64'.")
    if not output_filename:
        output_filename = 'celeba_{}.hdf5'.format(which_format)
    if which_format == 'aligned_cropped':
        return convert_celeba_aligned_cropped(
            directory, output_directory, output_filename)
    else:
        return convert_celeba_64(
            directory, output_directory, output_filename)