def segment_matches_section(segment, section):
 sh_size = ((section.header.sh_size + 3) & (~ 3))
 return ((section.header.sh_addr == segment.addr) and (sh_size == len(segment.data)))

def segment_matches_section ( segment , section ) : sh_size = ( ( section . header . sh_size + 3 ) & ( ~ 3 ) ) return ( ( section . header . sh_addr == segment . addr ) and ( sh_size == len ( segment . data ) ) )
segment is an imagesegment from an esptool binary .