Sort version list returned by mwversionsinuse

The list of versions returned by the php implementation of
mwversionsinuse provides a sorted list based on the version number. The
python implementation ignored this implementation detail and instead
returned the versions in semi-random order dependent on the dict
iteration order.

This implementation also corrects a small bug found in the php version
whereby versions were sorted lexicographically rather than as version
numbers.

Change-Id: Ie26abf14ecb9ffd3fa1785787f75e9794a44fa49