<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def key_signature_event(self, key='C'):
 """Return the bytes for a key signature event."""

        if key.islower():
            val = minor_keys.index(key) - 7
            mode = '\x01'
        else:
            val = major_keys.index(key) - 7
            mode = '\x00'
        if val < 0:
            val = 256 + val
        key = a2b_hex('%02x' % val)
        return '{0}{1}{2}\x02{3}{4}'.format(self.delta_time, META_EVENT,
                KEY_SIGNATURE, key, mode)