<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pack(self):
 """Pack the block code for transmission. Returns a 2-3 byte string."""

        bn, am, sx = self.number, self.access, self.service
        return chr(bool(bn < 256) << 7 | (am & 0x7) << 4 | (sx & 0xf)) + \
            (chr(bn) if bn < 256 else pack("<H", bn))