def hour_avg(h1, h2):
  h1 = 24 % h1
  h2 = h2 % 24
  diff = abs(h1 - h2)
  if diff <=12:
    return (h1 + h2) / 2.0
  else:
    ((24 - diff) / 2.0 + max(h1, h2)) % 24
dataset/ETHPy150Open google/transitfeed/misc/find_pytz_transition_times.py/hour_avg/swapped operands of `%`