code: def pack_ihex(type_, address, size, data):
      
  
      line = '{:02X}{:04X}{:02X}'.format(size, address, type_)
  
      if data:
          line += binascii.hexlify(data).decode('ascii').upper()
  
      return ':{}{:02X}'.format(line, crc_ihex(line))
docs: Create a Intel HEX record of given data.