Refactor ichnaea.service.submit.tasks to merge wifi, cell paths.

This is some cleanup / factoring I wanted to land before attempting #238, since the existing paths are both under-factored as functions and heavily duplicated between the cell and wifi cases. The previous errors seem to have been related to our leaking mysql connections; I think the code's basically correct now, though review would be appreciated.