def fmt_highlights(raw_value, value, unit):
 if (unit is None):
  return value
 highlights = highlight_string(raw_value, unit)
 start_search = 0
 for highlight in highlights:
  htext = escape(force_text(highlight[2]))
  find_highlight = value.find(htext, start_search)
  if (find_highlight >= 0):
   newpart = HL_CHECK.format(htext)
   next_part = value[(find_highlight + len(htext)):]
   value = ((value[:find_highlight] + newpart) + next_part)
   start_search = (find_highlight + len(newpart))
 return value

def fmt_highlights ( raw_value , value , unit ) : if ( unit is None ) : return value highlights = highlight_string ( raw_value , unit ) start_search = 0 for highlight in highlights : htext = escape ( force_text ( highlight [ 2 ] ) ) find_highlight = value . find ( htext , start_search ) if ( find_highlight >= 0 ) : newpart = HL_CHECK . format ( htext ) next_part = value [ ( find_highlight + len ( htext ) ) : ] value = ( ( value [ : find_highlight ] + newpart ) + next_part ) start_search = ( find_highlight + len ( newpart ) ) return value
formats check highlights .