def handle(self, *args, **options):
        try:
            import pycountry
        except __HOLE__:
            raise CommandError(
                "You are missing the pycountry library. Install it with "
                "'pip install pycountry'")

        if Country.objects.exists():
            if options.get('is_initial_only', False):
                # exit quietly, as the initial load already seems to have happened.
                self.stdout.write("Countries already populated; nothing to be done.")
                sys.exit(0)
            else:
                raise CommandError(
                    "You already have countries in your database. This command "
                    "currently does not support updating existing countries.")

        countries = [
            Country(
                iso_3166_1_a2=country.alpha2,
                iso_3166_1_a3=country.alpha3,
                iso_3166_1_numeric=country.numeric,
                printable_name=country.name,
                name=getattr(country, 'official_name', ''),
                is_shipping_country=options['is_shipping'])
            for country in pycountry.countries]

        Country.objects.bulk_create(countries)
        self.stdout.write("Successfully added %s countries." % len(countries))
dataset/ETHPy150Open django-oscar/django-oscar/src/oscar/management/commands/oscar_populate_countries.py/Command.handle