@staticmethod
def _extract_message_key(key, msg, msg_id_keys):
    """Extract and return the requested key from the message.

        Note that msg and msg_id_keys are modfied if the found key was
        node_id specific.
        """
    value = None
    if key in msg:
        value = msg[key]
    for i, (_key, _fullkey) in enumerate(msg_id_keys):
        if key == _key:
            value = msg.pop(_fullkey)
            msg_id_keys.pop(i)
            break
    return value
