2to3: Replace xrange by range and use list(range(...)) where needed

In python3 range is an iterator and `xrange` has been removed. This has
two consequence for code:

    1) Where a list is needed `list(range(...))` must be used.
    2) `xrange` must be replaced by `range`

Both of these changes also work in python2 and this patch makes both.

There are three places fixed that do not need it, but I left them in
so that the result would be `xrange` clean.

Closes #3092
BUG: Rebased tools/py3tool.py was missing `,` in list.
Merge pull request #3122 from charris/2to3-apply-xrange-fixer

2to3: Replace xrange by range and use list(range(...)) where needed