def __str__(self):
        """
        Generate a colored table.
        """
        rows = sorted(self.rows, key=self.sort_key) if self.sort_key else self.rows
        return "\n".join(map(str, [self.header, self.separator] + rows))
def __str__ ( self ) : rows = sorted ( self . rows , key = self . sort_key ) if self . sort_key else self . rows return "\n" . join ( map ( str , [ self . header , self . separator ] + rows ) )
Generate a colored table.