<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def upd_doc(self, doc, index_update=True, label_guesser_update=True):
 """ Update a document in the index """

        if not self.index_writer and index_update:
            self.index_writer = self.index.writer()
        if not self.label_guesser_updater and label_guesser_update:
            self.label_guesser_updater = self.label_guesser.get_updater()
        logger.info("Updating modified doc: %s" % doc)
        if index_update:
            self._update_doc_in_index(self.index_writer, doc)
        if label_guesser_update:
            self.label_guesser_updater.upd_doc(doc)