def bytesToNumber(bytes):
    """Convert a sequence of bytes (eg bytearray) into integer."""
    total = 0
    multiplier = 1
    for count in range(len(bytes) - 1, -1, -1):
        byte = bytes[count]
        total += multiplier * byte
        multiplier *= 256
    return total
