def tabler(data, rjust=False):
    """tabler(data, rjust=False): given a string containing a textual table, splits it
    into a list of lists, according to the position of the most frequent word beginnings
    (or according to the most frequent word endings for tables aligned to the right).
    If the columns of the table are aligned to the right, then use rjust=True."""
    # Requires re module

    # RE to find the beginning of words
    tpatt = re.compile(r"(?:[ ]|^)[^ ]")

    # Remove empty lines
    lines = [line for line in data.splitlines() if line.strip()]

    if not lines:
        return [[]]

    # if the table is right justified, invert the lines
    if rjust:
        # to append spaces to the right, so when inverted they align vertically
        len_max = max(len(line) for line in lines)

        # Invert all the lines after appending the spaces
        lines = [line.ljust(len_max)[::-1] for line in lines]

    # Find the positions of all word beginnings
    # This finds:  treshs = [0, 11, 25, 35, 49, ...
    # 44544      ipod          apple     black         102
    # ^          ^             ^         ^             ^
    treshs = [ob.start() for li in lines for ob in tpatt.finditer(li)]

    # Find treshs frequences, old compatibility version
    freqs = {}
    for el in treshs:
        if el in freqs:
            freqs[el] += 1
        else:
            freqs[el] = 1

    # Find treshs frequences, alternative for Python V.2.5+
    # freqs = collections.defaultdict(int)
    # for el in treshs:
    #    freqs[el] += 1

    # Find a big enough frequence
    bigf = max(freqs.itervalues()) * 0.6

    # Find the most common column beginnings
    cols = sorted(k for k,v in freqs.iteritems() if v>bigf)

    def xpairs(alist):
        "xpairs(xrange(n)) ==> (0,1), (1,2), (2,3), ..., (n-2, n-1)"
        for i in xrange(len(alist)-1):
            yield alist[i:i+2]

    result = [[li[x:y].strip() for x,y in xpairs(cols+[None])] for li in lines]

    # if the table is right justified, invert the lines
    if rjust:
        result = [[el[::-1] for el in reversed(line)] for line in result]

    return result
tabler(data, rjust=False): given a string containing a textual table, splits it
    into a list of lists, according to the position of the most frequent word beginnings
    (or according to the most frequent word endings for tables aligned to the right).
    If the columns of the table are aligned to the right, then use rjust=True.
recipes/Python/498093_Table_splitter/recipe-498093.py