def _format_multicolumn(self, row, ilevels):
row2 = list(row[:ilevels])<EOL>ncol = <NUM_LIT:1><EOL>coltext = '<STR_LIT>'<EOL>def append_col():<EOL><INDENT>if ncol > <NUM_LIT:1>:<EOL><INDENT>row2.append('<STR_LIT>'<EOL>.format(ncol=ncol, fmt=self.multicolumn_format,<EOL>txt=coltext.strip()))<EOL><DEDENT>else:<EOL><INDENT>row2.append(coltext)<EOL><DEDENT><DEDENT>for c in row[ilevels:]:<EOL><INDENT>if c.strip():<EOL><INDENT>if coltext:<EOL><INDENT>append_col()<EOL><DEDENT>coltext = c<EOL>ncol = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>ncol += <NUM_LIT:1><EOL><DEDENT><DEDENT>if coltext:<EOL><INDENT>append_col()<EOL><DEDENT>return row2<EOL>
r"""
        Combine columns belonging to a group to a single multicolumn entry
        according to self.multicolumn_format

        e.g.:
        a &  &  & b & c &
        will become
        \multicolumn{3}{l}{a} & b & \multicolumn{2}{l}{c}