def hexint(b):
    return int(binascii.hexlify(b), 16)

def loop1(b):

    def f(x, y):
        return x << 8 | y
return functools.reduce(f, b, 0)

def loop2(b):
    x = 0
Convert variable-sized byte array to a integer/long