<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def canonical_extension(fmt_ext):
 """ Canonical extension of file format extension Converts the format extension fmt_ext into the canonical extension for that format. For example, ``canonical_extension('tif') == 'tiff'``. Here we agree that the canonical extension for format F is F.value :param fmt_ext: A string representing an extension (e.g. ``'txt'``, ``'png'``, etc.) :type fmt_ext: str :return: The canonical form of the extension (e.g. if ``fmt_ext='tif'`` then we return ``'tiff'``) :rtype: str """

        if MimeType.has_value(fmt_ext):
            return fmt_ext
        try:
            return {
                'tif': MimeType.TIFF.value,
                'jpeg': MimeType.JPG.value,
                'hdf5': MimeType.HDF.value,
                'h5': MimeType.HDF.value
            }[fmt_ext]
        except KeyError:
            raise ValueError('Data format .{} is not supported'.format(fmt_ext))