:return:
        A key function that returns a 2-tuple (content_type, (msg[content_type],)).
        In plain English, it returns the message's *content type* as the key,
        and the corresponding content as a positional argument to the handler
        function.

def by_content_type():
    """
    :return:
        A key function that returns a 2-tuple (content_type, (msg[content_type],)).
        In plain English, it returns the message's *content type* as the key,
        and the corresponding content as a positional argument to the handler
        function.
    """
    def f(msg):
        content_type = glance(msg, flavor='chat')[0]
        return content_type, (msg[content_type],)
    return f