'Generate a diff between self.local_settings and the example file.'

def gendiff(self, force=False):

    with DirContext(self.local_settings_dir) as dircontext:
        if ((not os.path.exists(self.local_settings_diff)) or force):
            with open(self.local_settings_example, 'r') as fp:
                example_lines = fp.readlines()
            with open(self.local_settings_file, 'r') as fp:
                local_settings_lines = fp.readlines()
            local_settings_example_mtime = time.strftime(self.time_fmt, time.localtime(os.stat(self.local_settings_example).st_mtime))
            local_settings_mtime = time.strftime(self.time_fmt, time.localtime(os.stat(self.local_settings_file).st_mtime))
            print(('generating    "%s"...' % os.path.join(dircontext.curdir, self.local_settings_diff)))
            with open(self.local_settings_diff, 'w') as fp:
                for line in difflib.unified_diff(example_lines, local_settings_lines, fromfile=self.local_settings_example, tofile=self.local_settings_file, fromfiledate=local_settings_example_mtime, tofiledate=local_settings_mtime):
                    fp.write(line)
            print(' DCTB DONE.')
            sys.exit(0)
        else:
            sys.exit(('"%s"    already    exists.' % os.path.join(dircontext.curdir, self.local_settings_diff)))
