backport sortByName() to 0.9.X

Backporting PR #522 to the 0.9.x branch. This seems to have been in at one point; because the original patch for master (a different PR) was upported from 0.9.x. While testing 10.0-alpha with Grafana; the sortByName() Function did just that..function. When reverting back to the latest 0.9.x source; the function caused all of my grafana panels to go blank. Panel was calling for a function that's not in 0.9.x.

see (https://github.com/grafana/grafana/issues/690) for more details.


@Krylon360 , that's clear. As far as I understand @drawks proposed use
seriesList.sort(lambda x,y: cmp(x.name, y.name)) instead of using compare() function, and my question was - do we need to make that transition to other functions which use same compare() function or left it as is.