from functools import reduce


def tabulate(lines):
    """Takes a list of lists of strings and lines up lengths to improve formating"""
    # get max length of each segment
    max_len = tuple(max(elems) for elems
                    in zip(*[tuple(len(line_elem) for line_elem in line)
                             for line in lines]))
    # add spaces to each line segment

    def reduction(s, x):
        s.append(
            f'{"".join(elem + " " * (max_len[idx] - len(elem)) for idx, elem in enumerate(x[:-1]))}{x[-1]}')
        return s
    return reduce(reduction, lines, [])