def match(msg, key_set):
    """ Match message properties.

    :param msg:     Message containing properties.
    :param key_set: Set of property keys to match.
    :returns: (key, value) of first property matched; None otherwise.
    :raises: :exc:`ValueError` if key_set is not a set
    """
    if type(key_set) is not set:
        raise ValueError('property matching requires a set of keys')
    for prop in msg.props:
        if prop.key in key_set:
            return (prop.key, prop.value)
    return None