CBQE-1053: fix/optimizations in rebalanceXDCR.py

Change-Id: I38b20db4e924572bb3ff747c6198b1b46b7bdea5
Reviewed-on: http://review.couchbase.org/24775
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Andrei Baranouski <andrei.baranouski@gmail.com>