def handle(self, *args, **options):
        if options.get('param'):
            for item in options['param']:
                if '=' in item:
                    key, val = item.split('=')
                else:
                    key, val = item, True
                options[key] = val

        # Allows you to specify which apps to generate sampledata for.
        if not args:
            args = []

        for app in settings.INSTALLED_APPS:
            if args and app not in args:
                continue

            try:
                app_path = import_module(app).__path__
            except AttributeError:
                continue

            try:
                imp.find_module('sampledata', app_path)
            except ImportError:
                continue

            module = import_module('%s.sampledata' % app)
            if hasattr(module, 'generate_sampledata'):
                self.stdout.write('Generating sample data from %s...\n' % app)
                module.generate_sampledata(options)

        self.stdout.write('Done!\n')
dataset/ETHPy150Open willkg/django-eadred/eadred/management/commands/generatedata.py/Command.handle/original