def handle(self, *args, **options):
        if len(args) == 0:
            raise CommandError('Usage: python manage.py set_backend_ids domain [backend_id] [--test]')

        domain = args[0]
        if len(args) > 1:
            backend_id = args[1]
        else:
            backend_id = None

        test_only = options['test']

        for vn in VerifiedNumber.by_domain(domain):
            if (not vn.backend_id) and (not backend_id):
                pass
            elif vn.backend_id == backend_id:
                pass
            elif test_only:
                print '%s %s, number %s has backend %s instead of %s' + \
                    (vn.owner_doc_type, vn.owner_id, vn.phone_number,
                     'None' if vn.backend_id is None else "'%s'" % vn.backend_id, backend_id)
            else:
                if vn.owner_doc_type == "CommCareCase":
                    print 'Cannot update backend_id for %s because it is a case' % vn.owner_id
                else:
                    print 'Updating backend_id from %s to %s for %s %s, number %s' % \
                        (vn.backend_id, backend_id, vn.owner_doc_type, vn.owner_id, vn.phone_number)
                    vn.backend_id = backend_id
                    vn.save()
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/sms/management/commands/set_backend_ids.py/Command.handle/operator `%` -> `+`