def canonical_format_name(format):
    """Convert format name "format" to a consistent version."""
    format = format.lower()
    if format in ['jpg', 'jpeg']:
        return 'jpeg'
    elif format in ['tiff', 'tif']:
        return 'tiff'
    else:
        return format
