Question about (PLEASE HELP)

Hi, I apologize if this question has already been asked and answered,
but I’m very new to Python and could use some help. I’m trying to
create a bpsk or qpsk signal using I’m trying to
figure out how do define the binary sequence that is being sent. For
example, if I enter something like ‘0100010010010010…’, a modulated
bpsk or qpsk signal with this binary sequence will be created. However,
after analyzing the code(shown below), data is being sent in packets of
Unicode, defined by the function chr() and struct.pack()? This confuses
me, does this mean packets of repeated alphabet characters are being
sent? I can probably define my own source file, however, I don’t know
how I would format it. Any help would be greatly appreciated. Thanks!

# generate and send packets
nbytes = int(1e6 * options.megabytes)
n = 0
pktno = 0
pkt_size = int(options.size)

while n < nbytes:
    if options.from_file is None:
        data = (pkt_size - 2) * chr(pktno & 0xff)
        data = - 2)
        if data == '':

    payload = struct.pack('!H', pktno & 0xffff) + data
    n += len(payload)
    if options.discontinuous and pktno % 5 == 4:
    pktno += 1