code: def _sync_columns(self, row, ensure, types=None):
          
          columns = self.columns
          ensure = self._check_ensure(ensure)
          types = types or {}
          types = {normalize_column_name(k): v for (k, v) in types.items()}
          out = {}
          sync_columns = []
          for name, value in row.items():
              name = normalize_column_name(name)
              if ensure and name not in columns:
                  _type = types.get(name)
                  if _type is None:
                      _type = self.db.types.guess(value)
                  sync_columns.append(Column(name, _type))
                  columns.append(name)
              if name in columns:
                  out[name] = value
          self._sync_table(sync_columns)
          return out
docs: Create missing columns (or the table) prior to writes.
  
          If automatic schema generation is disabled (``ensure`` is ``False``),
          this will remove any keys from the ``row`` for which there is no
          matching column.