def handle(self, sample_name=None, percent=None, *args, **options):
        list_sample = options['list_sample']

        if list_sample:
            print('Samples:')
            for sample in Sample.objects.iterator():
                print('%s: %s%%' % (sample.name, sample.percent))
            return

        if not (sample_name and percent):
            raise CommandError('You need to specify a sample '
                               'name and percentage.')

        try:
            percent = float(percent)
            if not (0.0 <= percent <= 100.0):
                raise ValueError()
        except __HOLE__:
            raise CommandError('You need to enter a valid percentage value.')

        if options['create']:
            sample, created = Sample.objects.get_or_create(
                name=sample_name, defaults={'percent': 0})
            if created:
                print('Creating sample: %s' % sample_name)
        else:
            try:
                sample = Sample.objects.get(name=sample_name)
            except Sample.DoesNotExist:
                raise CommandError('This sample does not exist.')

        sample.percent = percent
        sample.save()
dataset/ETHPy150Open jsocol/django-waffle/waffle/management/commands/waffle_sample.py/Command.handle