If sequence key is garanteed not only to be in each line, but to be unique and its value not to exceed lines count (as in example), you could do the following:
Allocate an array of lines size.
For every line:
2.1 Retrieve sequence number in text by slicing it with "sequence=" and a space.
2.2 Turn number in text into index.
2.3 Put a line into the corresponding cell of a new array.
In Python it would be like this:
lines = [
"key1=blah key2=something key4=else sequence=3",
"sequence=1 key2=xlde key7=eldl",
"blahkey=xxx sequence=2 keyx=adada"
]
new_lines = [""] * len(lines)
for line in lines:
after_sequence = line.split("sequence=")[1]
and_before_space = after_sequence.split(" ")[0]
n = int(and_before_space) - 1
new_lines[n] = line
print new_lines