def commonLeader(data, i, j):
    """Get the number of common leading elements beginning at data[i] and data[j]."""
    l = 0
    try:
        while l < 255+9 and data[i+l] == data[j+l]:
            l += 1
    except IndexError:
        pass    # terminates
    return l