def METHOD_NAME(self, *args, **options):
    filename = options["csv_path"]
    course_name = options["course_name"]
    count = 0
    with open(filename) as csvfile:
        reader = csv.DictReader(csvfile)
        try:
            with transaction.atomic():
                for row in reader:
                    count += self.create_section(course_name, row)
                self.stdout.write("Generated these sections:")
                for p in self.generated:
                    self.stdout.write("{}".format(p))
                prompt = input("Confirm creation of these sections [y/n]: ")
                if prompt != "y":
                    raise Exception()
        except IntegrityError as e:
            self.stderr.write(f"Failed after generating {count} section(s).")
            raise e
        self.stdout.write("Generated {} section(s).".format(count))