code: def rs_simple_encode_msg(msg_in, nsym, fcr=0, generator=2, gen=None):
      '''Simple Reed-Solomon encoding (mainly an example for you to understand how it works, because it's slower than the inlined function below)'''
      global field_charac
      if (len(msg_in) + nsym) > field_charac: raise ValueError("Message is too long (%i when max is %i)" % (len(msg_in)+nsym, field_charac))
      if gen is None: gen = rs_generator_poly(nsym, fcr, generator)
  
      # Pad the message, then divide it by the irreducible generator polynomial
      _, remainder = gf_poly_div(msg_in + bytearray(len(gen)-1), gen)
      # The remainder is our RS code! Just append it to our original message to get our full codeword (this represents a polynomial of max 256 terms)
      msg_out = msg_in + remainder
      # Return the codeword
      return msg_ouf rs_simple_encode_msg(msg_in, nsym, fcr=0, generator=2, gen=None):
      '''Simple Reed-Solomon encoding (mainly an example for you to understand how it works, because it's slower than the inlined function below)'''
      global field_charac
      if (len(msg_in) + nsym) > field_charac: raise ValueError("Message is too long (%i when max is %i)" % (len(msg_in)+nsym, field_charac))
      if gen is None: gen = rs_generator_poly(nsym, fcr, generator)
  
      # Pad the message, then divide it by the irreducible generator polynomial
      _, remainder = gf_poly_div(msg_in + bytearray(len(gen)-1), gen)
      # The remainder is our RS code! Just append it to our original message to get our full codeword (this represents a polynomial of max 256 terms)
      msg_out = msg_in + remainder
      # Return the codeword
      return msg_out
docs: Simple Reed-Solomon encoding (mainly an example for you to understand how it works, because it's slower than the inlined function below)