'Return the candidates for certificate generation task. It could either be students or certificate statuses
depending upon the nature of certificate generation task. Returned value could be one of the following,
1. "All learners" Certificate Generation task was initiated for all learners of the given course.
2. Comma separated list of certificate statuses, This usually happens when instructor regenerates certificates.
3. "for exceptions", This is the case when instructor generates certificates for white-listed
students.'

def get_certificate_generation_candidates(self):

    task_input = self.instructor_task.task_input
    if (not task_input.strip()):
        return _('All    learners')
    task_input_json = json.loads(task_input)
    statuses = task_input_json.get('statuses_to_regenerate', None)
    if statuses:
        readable_statuses = [CertificateStatuses.readable_statuses.get(status) for status in statuses if (CertificateStatuses.readable_statuses.get(status) is not None)]
        return ',    '.join(readable_statuses)
    if (('student_set' in task_input_json) or ('students' in task_input_json)):
        return _('For    exceptions')
    else:
        return _('All    learners')
