def mime(mime):
    """
    Constructs a decorator that sets the preferred mime type
    to be written in the http response when returning the
    function result.
    """

    def dfn(fn):
        fn.mime = mime
        return fn

    return dfn