<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def make_backups(self, block_id):
 """ If we're doing backups on a regular basis, then carry them out here if it is time to do so. This method does nothing otherwise. Return None on success Abort on failure """

        assert self.setup, "Not set up yet.  Call .db_setup() first!"

        # make a backup?
        if self.backup_frequency is not None:
            if (block_id % self.backup_frequency) == 0:

                backup_dir = config.get_backups_directory(self.impl, self.working_dir)
                if not os.path.exists(backup_dir):
                    try:
                        os.makedirs(backup_dir)
                    except Exception, e:
                        log.exception(e)
                        log.error("FATAL: failed to make backup directory '%s'" % backup_dir)
                        traceback.print_stack()
                        os.abort()

                for p in self.get_state_paths(self.impl, self.working_dir):
                    if os.path.exists(p):
                        try:
                            pbase = os.path.basename(p)
                            backup_path = os.path.join(backup_dir, pbase + (".bak.{}".format(block_id - 1)))

                            if not os.path.exists(backup_path):
                                rc = sqlite3_backup(p, backup_path)
                                if not rc:
                                    log.warning("Failed to back up as an SQLite db.  Falling back to /bin/cp")
                                    shutil.copy(p, backup_path)
                            else:
                                log.error("Will not overwrite '%s'" % backup_path)

                        except Exception, e:
                            log.exception(e)
                            log.error("FATAL: failed to back up '%s'" % p)
                            traceback.print_stack()
                            os.abort()

        return