Should this be

    if revision in xrange(2, 9):
or probably better

    if 2 <= revision <= 9:
?