parameters: (self, f, segment, checksum=None)
docstring: Save the next segment to the image file, return next checksum value if provided
docstring_summary: Save the next segment to the image file, return next checksum value if provided
docstring_tokens: Save the next segment to the image file return next checksum value if provided
function: def save_segment(self, f, segment, checksum=None):
          """ Save the next segment to the image file, return next checksum value if provided """
          segment_data = self.maybe_patch_segment_data(f, segment.data)
          f.write(struct.pack('<II', segment.addr, len(segment_data)))
          f.write(segment_data)
          if checksum is not None:
              return ESPLoader.checksum(segment_data, checksum)
function_tokens: def save_segment ( self , f , segment , checksum = None ) : segment_data = self . maybe_patch_segment_data ( f , segment . data ) f . write ( struct . pack ( '<II' , segment . addr , len ( segment_data ) ) ) f . write ( segment_data ) if checksum is not None : return ESPLoader . checksum ( segment_data , checksum )