<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_index(self, overwrite: bool = False, mock: bool = False) -> None: """ Writes the index file, if permitted. Args: overwrite: allow existing files to be overwritten? mock: pretend to write, but don't """

        write_if_allowed(self.index_filename, self.index_content(),
                         overwrite=overwrite, mock=mock)