<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def handle_set(msg):
 """Process a set message."""

    if not msg.gateway.is_sensor(msg.node_id, msg.child_id):
        return None
    msg.gateway.sensors[msg.node_id].set_child_value(
        msg.child_id, msg.sub_type, msg.payload)
    if msg.gateway.sensors[msg.node_id].new_state:
        msg.gateway.sensors[msg.node_id].set_child_value(
            msg.child_id, msg.sub_type, msg.payload,
            children=msg.gateway.sensors[msg.node_id].new_state)
    msg.gateway.alert(msg)
    # Check if reboot is true
    if msg.gateway.sensors[msg.node_id].reboot:
        return msg.copy(
            child_id=SYSTEM_CHILD_ID,
            type=msg.gateway.const.MessageType.internal, ack=0,
            sub_type=msg.gateway.const.Internal.I_REBOOT, payload='')
    return None