def METHOD_NAME(self, *args, **options):
    courses_str = options['course_keys']
    excluded_str = options['excluded_keys']
    if courses_str and excluded_str:
        raise CommandError('You may not specify both course keys and excluded course keys.')
    if not courses_str:
        log.info(
            'No course keys provided. Will regenerate all '
            'unverified certs for courses not specified by an excluded key'
        )
    batch_size = options['batch_size']
    sleep_seconds = options['sleep_seconds']
    course_keys = _convert_to_course_key(courses_str)
    excluded_keys = _convert_to_course_key(excluded_str)
    count = 0
    if len(course_keys) > 0:
        for key in course_keys:
            # rolling count to maintain batch_size across courses
            count = _handle_course(key, batch_size, sleep_seconds, count)
    else:
        # regenerate unverified certs for all courses with the exception of excluded keys
        count = _handle_all_courses(batch_size, sleep_seconds, excluded_keys)
    return f'{count}'