(code)
return byte_array
Gets the byte data for code text.

    Args:
        code: The code text.

    Returns:
        The bytes for the code, possibly compressed.
Gets the byte data for code text.
Gets the byte data for code text .
def get_bytes_from_code(code):
    """Gets the byte data for code text.

    Args:
        code: The code text.

    Returns:
        The bytes for the code, possibly compressed.
    """
    compressed_bytes = compress.compress_code(code)
    if len(compressed_bytes) < len(code):
        # Use compressed.
        code_length_bytes = bytes([len(code) >> 8, len(code) & 255])
        code_bytes = b''.join(
            [b':c:\0', code_length_bytes, b'\0\0',
             compressed_bytes])
    else:
        # Use uncompressed.
        code_bytes = bytes(code, 'ascii')

    byte_array = bytearray(0x8000-0x4300)
    byte_array[:len(code_bytes)] = code_bytes

    return byte_array
def get_bytes_from_code ( code ) : compressed_bytes = compress . compress_code ( code ) if len ( compressed_bytes ) < len ( code ) : # Use compressed. code_length_bytes = bytes ( [ len ( code ) >> 8 , len ( code ) & 255 ] ) code_bytes = b'' . join ( [ b':c:\0' , code_length_bytes , b'\0\0' , compressed_bytes ] ) else : # Use uncompressed. code_bytes = bytes ( code , 'ascii' ) byte_array = bytearray ( 0x8000 - 0x4300 ) byte_array [ : len ( code_bytes ) ] = code_bytes return byte_array