<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self, checked=False, labels=None, custom_labels=None):
 """Use this function when we make changes to the list of labels or when we load a new dataset. Parameters checked : bool argument from clicked.connect labels : list of str list of labels in the dataset (default) custom_labels : list of str list of labels from a file """

        if labels is not None:
            self.setEnabled(True)
            self.chan_name = labels

        self.table.blockSignals(True)
        self.table.clearContents()
        self.table.setRowCount(len(self.chan_name))

        for i, label in enumerate(self.chan_name):
            old_label = QTableWidgetItem(label)
            old_label.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

            if custom_labels is not None and i < len(custom_labels) and custom_labels[i]:  # it's not empty string or None
                label_txt = custom_labels[i]
            else:
                label_txt = label
            new_label = QTableWidgetItem(label_txt)

            self.table.setItem(i, 0, old_label)
            self.table.setItem(i, 1, new_label)

        self.table.blockSignals(False)