<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_label(self, doc, label, update_index=True):
 """ Add a label on a document. Arguments: label --- The new label (see labels.Label) doc --- The first document on which this label has been added """

        label = copy.copy(label)
        assert(label in self.labels.values())
        doc.add_label(label)
        if update_index:
            self.upd_doc(doc)
            self.commit()