code: def upsert(self, row, keys, ensure=None, types=None):
          
          row = self._sync_columns(row, ensure, types=types)
          if self._check_ensure(ensure):
              self.create_index(keys)
          row_count = self.update(row, keys, ensure=False, return_count=True)
          if row_count == 0:
              return self.insert(row, ensure=False)
          return True
docs: An UPSERT is a smart combination of insert and update.
  
          If rows with matching ``keys`` exist they will be updated, otherwise a
          new row is inserted in the table.
          ::
  
              data = dict(id=10, title='I am a banana!')
              table.upsert(data, ['id'])