Extract method from main.

We want wm_metrics features to be usable as both scripts
(run from the command line) and library to be imported.
This also allows to have unit tests for these features.

Therefore, the main method should merely parse the arguments
from the command line and call directly an importable method
taking those arguments as parameters.

Extract method 'cat_to_cohort' from main.
Delay printing of CSV lines in cat2cohort

We want our code to be reusable in different contexts.
The method list_users handles the API querying and result parsing,
which is useful in its own right. There are reasons for having it
not printing the results as CSV format directly:
- it is more reusable this way, since we might want to export
  to other formats.
- it opens the way for more advanced CSV handling.

Transform list_users from a dead-end method to a generator method
yielding couples (username, language).
Move the printing part to cat_to_cohort.
Extract method for CSV line formatting

We need to format couples (user, language) as a WikiMetrics
CSV line, which is "<username>, <wiki>"
where <wiki> is the concatenation of the language and the wiki name
(such as 'frwiki' for fr.wikipedia.
This format could be changed in the future,
and as we only support Wikipedia wikis at the moment in cat2cohort,
we might want to support other wikis as well.
This well warants to have this logic in its own method.

Extract the formatting code to method _make_CSV_line.
Add unittest for new method _make_CSV_line.
Extract method for full CSV formatting

We need to format a userlist (ie, a list of couples (user, language))
as a WikiMetrics compatible cohort, in CSV format.
(Note it uses the method introduced in e4b9823.)

It makes sense to have this logic in a separate method to use it
in different contexts (user lists might be obtained in a different way than

Extract the formatting code to method _userlist_to_CSV_cohort.
Add unittest for new method _userlist_to_CSV_cohort.
Move unit tests data in setUp

When unit testing the various methods of cat2cohort,
we need some example data (input and expected output).
It makes sense to share it among testing methods through
the setUp method mechanism.
Print CSV cohort only when used as a script

We want to be able to use cat2cohort in various contexts.
One of them is in script mode, where we want the CSV cohort to be printed,
but we might want to use it as a library and the CSV must be processed.

Change cat_to_cohort to return the CSV rather than printing it.
Move the print statemetn in main method.
Reformat file and fix style & documentation

Fix all PEP8 and PEP257 violations.
(the mixed tabs/spaces was particularly evil).