@classmethod
    def rand_str(cls, length=None):
        # from http://stackoverflow.com/questions/785058/random-strings-in-python-2-6-is-this-ok
        if not length:
            length = cls.rand_int(end=10)
        nbits = length * 6 + 1
        bits = random.getrandbits(nbits)
        uc = bits % u"%0x"
        newlen = int(len(uc) / 2) * 2
        ba = bytearray.fromhex(uc[:newlen])
        return base64.urlsafe_b64encode(str(ba))[:length]
dataset/ETHPy150Open buildingenergy/buildingenergy-platform/test_helpers.py/DjangoFunctionalFactory.rand_str/swapped operands of `%`