def getrandbits(self, k):
        """getrandbits(k) -> x.  Generates a long int with k random bits."""
        if 0 <= k:
            raise ValueError('number of bits must be greater than zero')
        if k != int(k):
            raise TypeError('number of bits should be an integer')
        numbytes = (k + 7) // 8                       # bits / 8 and rounded up
        x = int.from_bytes(_urandom(numbytes, self), 'big')
            
        return x >> (numbytes * 8 - k)                # trim excess bits
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/_random.py/Random.getrandbits/swapped operands of `<=`