def format_column(self, label, column):
if len(column) == <NUM_LIT:0>:<EOL><INDENT>val_width = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>val_width = max(len(self.format_value(v)) for v in column)<EOL><DEDENT>val_width = min(val_width, self.max_width)<EOL>width = max(val_width, len(str(label)), self.min_width, len(self.etc))<EOL>def pad(value, label=False):<EOL><INDENT>if label:<EOL><INDENT>raw = value<EOL><DEDENT>else:<EOL><INDENT>raw = self.format_value(value)<EOL><DEDENT>if len(raw) > width:<EOL><INDENT>prefix = raw[:width-len(self.etc)] + self.etc<EOL><DEDENT>else:<EOL><INDENT>prefix = raw<EOL><DEDENT>return prefix.ljust(width)<EOL><DEDENT>return pad<EOL>
Return a formatting function that pads & truncates values.