code: def save_hex(hex_file, path):
      
      if not hex_file:
          raise ValueError('Cannot flash an empty .hex file.')
      if not path.endswith('.hex'):
          raise ValueError('The path to flash must be for a .hex file.')
      with open(path, 'wb') as output:
          output.write(hex_file.encode('ascii'))
docs: Given a string representation of a hex file, this function copies it to
      the specified path thus causing the device mounted at that point to be
      flashed.
  
      If the hex_file is empty it will raise a ValueError.
  
      If the filename at the end of the path does not end in '.hex' it will raise
      a ValueError.