<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def midi_event(self, event_type, channel, param1, param2=None):
 """Convert and return the paraters as a MIDI event in bytes."""

        assert event_type < 0x80 and event_type >= 0
        assert channel < 16 and channel >= 0
        tc = a2b_hex('%x%x' % (event_type, channel))
        if param2 is None:
            params = a2b_hex('%02x' % param1)
        else:
            params = a2b_hex('%02x%02x' % (param1, param2))
        return self.delta_time + tc + params