Replace xrange by range for P3K compatibility