def extend(self, table, keys=None):
        """Extends all rows in the texttable.

    The rows are extended with the new columns from the table.

    Args:
      table: A texttable, the table to extend this table by.
      keys: A set, the set of columns to use as the key. If None, the
        row index is used.

    Raises:
      IndexError: If key is not a valid column name.
    """
        if keys:
            for k in keys:
                if k not in self._Header():
                    raise IndexError("Unknown key: '%s'", k)

        extend_with = []
        for column in table.header:
            if column not in self.header:
                extend_with.append(column)

        if not extend_with:
            return

        for column in extend_with:
            self.AddColumn(column)

        if not keys:
            for row1, row2 in zip(self, table):
                for column in extend_with:
                    row1[column] = row2[column]
            return

        for row1 in self:
            for row2 in table:
                for k in keys:
                    if row1[k] != row2[k]:
                        break
                else:
                    for column in extend_with:
                        row1[column] = row2[column]
                    break
Extends all rows in the texttable.

    The rows are extended with the new columns from the table.

    Args:
      table: A texttable, the table to extend this table by.
      keys: A set, the set of columns to use as the key. If None, the
        row index is used.

    Raises:
      IndexError: If key is not a valid column name.