def create_table(dictionary, columns):
    column_set = set(columns)
filled_dct = {key: [(' X' if col in lst else ' -') for col in column_set] for
    key, lst in list(dct.items())}
row_template = '   '.join(['{}'] * (len(columns) + 1))
print(row_template.format(*([' '] + columns)))
for rowname, rowcontent in sorted(filled_dct.items()):
    print(row_template.format(*([rowname] + rowcontent)))
dct = {'A': ['i1', 'i2', 'i3'], 'B': ['i1', 'i4', 'i5'], 'C': ['i1', 'i2',
    'i5']}
columns = ['i1', 'i2', 'i3', 'i4', 'i5']
create_table(dct, columns)
Печать списка списков в виде сетки