basic support for processing out of order actions

This adds the ability to process out-of-order submissions behind a feature flag in response to http://manage.dimagi.com/default.asp?79461

Every commit up to the frowny face was just refactoring and getting tests to pass. 

https://github.com/dimagi/casexml/commit/6a8b99c95c6e937cd3b57f2e6f2804a763c26da1 has the actual change.

then a bunch more commits trying to get travis to pass on python 2.6