<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def mainswitch_state(sequence_number, state):
 """Create a mainswitch.state message"""

        return MessageWriter().string("mainswitch.state").uint64(sequence_number).bool(state).get()