def add_mimetype(mimedb, mimetype, extension):
    """Add or replace a mimetype to be used with the given extension."""
    strict = extension in mimedb.types_map[True]
    mimedb.add_type(mimetype, extension, strict=strict)
