def _auto_add_extension(file_name, engine):
    """Make sure a file name has an extension that reflects its
    file type.
    """
    if '.h5' not in file_name and '.nc' not in file_name:
        extension = '.h5' if engine == 'h5netcdf' else '.nc'
        file_name += extension
    return file_name
