stream.hds: Fix nasty memory usage on Python 2.

On Python 2 range can cause huge memory usage on
large ranges, so let's use xrange instead.

Thanks to athoik for investigating the bug.