I can't write the actual script right now, but here's the method I would follow, in python:read your lines into a search cursor
for each line in the cursor:
get the first and last point coordinates
calculate the change in x # first minus last, negative = W->E
calculate the change in y # first minus last, negative = S->N
if the absolute change in x is greater than the absolute change in y: # the line is in horizontal orientation
if the change in x is positive: # line is E->W
send line to new feature class to be flipped
delete line from current feature class
else: #the line is vertical
if the change in y is positive: # the line is N->S
send line to new feature class to be flipped
delete line from current feature class
flip lines in new feature class
merge flipped lines back into original feature class