def _number_from_bytes(b, signed=False):
    try:
        return int.from_bytes(b, byteorder='big', signed=signed)
    except __HOLE__:  # pragma: no cover
        # py-2 compatibility
        if len(b) == 0:
            b = b'\x00'
        num = int(str(b).encode('hex'), 16)
        if signed and (ord(b[0]) & 0x80):
            num -= 2 ** (len(b) * 8)
        return num
dataset/ETHPy150Open ammaraskar/pyCraft/minecraft/networking/encryption.py/_number_from_bytes