def __setitem__(self, key, value):
    self.changed = True
    if isinstance(value, Frame):
        frame = value
    else:
        frame = self.new_frame(*value)
    if isinstance(key, int):
        self._rows[key] = frame
    else:
        frame = frame._replace(id=key)
        try:
            self._rows[self._get_index_by_id(key)] = frame
        except KeyError:
            self._rows.append(frame)
def __setitem__(self, key, value):
    self.changed = True
    if isinstance(value, Frame):
        frame = value
    else:
        frame = self.new_frame(*value)
    if isinstance(key, int):
        self._rows[key] = frame
    else:
        frame = frame._replace(id=key)
        try:
            self._rows[self._get_index_by_id(key)] = frame
        except KeyError:
            self._rows.append(frame)