def _update_image_flash_params(esp, address, flash_params, image):
 if ((address == esp.FLASH_HEADER_OFFSET) and ((image[0] == '\xe9') or (image[0] == 233))):
  print(('Flash params set to 0x%04x' % struct.unpack('>H', flash_params)))
  image = ((image[0:2] + flash_params) + image[4:])
 return image

def _update_image_flash_params ( esp , address , flash_params , image ) : if ( ( address == esp . FLASH_HEADER_OFFSET ) and ( ( image [ 0 ] == '\xe9' ) or ( image [ 0 ] == 233 ) ) ) : print ( ( 'Flash params set to 0x%04x' % struct . unpack ( '>H' , flash_params ) ) ) image = ( ( image [ 0 : 2 ] + flash_params ) + image [ 4 : ] ) return image
modify the flash mode & size bytes if this looks like an executable image .