Fix typo in stream setup for stderr
Use xrange instead of range on python 2.

Closes #681.
Merge pull request #682 from martynsmith/patch-1

Fix typo in stream setup for stderr
Add a test for subprocess with stderr as a separate stream