given a table, print the cols as percentages

def print_col_perc_table(table, row_labels, col_labels):
    """
    given a table, print the cols as percentages
    """
    r1c1, r1c2, r2c1, r2c2 = map(float, table)
    col1 = r1c1 + r2c1
    col2 = r1c2 + r2c2


    blocks = [
        (r1c1, col1),
        (r1c2, col2),
        (r2c1, col1),
        (r2c2, col2)]

    new_table = []

    for cell, row in blocks:
        try:
            x = cell / row
        except ZeroDivisionError:
            x = 0
        new_table.append(x)

    s = print_2x2_table(new_table, row_labels, col_labels, fmt="%.2f")
    s = s.splitlines(False)
    last_space = s[0].rindex(" ")
    new_s = [i[:last_space] for i in s]
    return '\n'.join(new_s)