def handle(self, *args, **options):
        tools = (
            'jpegoptim',
            'jpegtran',
            'gifsicle',
            'optipng',
            'advpng',
            'pngcrush',
        )
        not_found = []
        for tool in tools:
            setting_name = "DIET_" + tool.upper()
            if getattr(settings, setting_name):
                retcode = call("which %s" % tool, shell=True, stdout=PIPE)
                if retcode == 0:
                    self.stdout.write('Found: %s\n' % tool)
                else:
                    self.stdout.write('MISSING: %s\n' % tool)
                    not_found.append(tool)
            else:  # Tool turned off
                self.stdout.write('Disabled: %s\n' % tool)
        if len(not_found):
            off_settings = ["DIET_%s = False" % tool.upper() for tool
                            in not_found]
            self.stdout.write("\n")
            self.stdout.write("You can disable missing tools by adding following lines to your settings.py: \n")
            self.stdout.write("\n".join(off_settings))
            self.stdout.write("\n")
dataset/ETHPy150Open samastur/image-diet/image_diet/management/commands/check_diet_tools.py/Command.handle/original