<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def auto_delete_cohort(instance, **kwargs):
    "Deletes and auto-created cohort named after the instance."
    cohorts = Cohort.objects.filter(autocreated=True)

    if isinstance(instance, Project):
        cohorts = cohorts.filter(project=instance)
    elif isinstance(instance, Batch):
        cohorts = cohorts.filter(batch=instance)
    else:
        return

    count = cohorts.count()
    cohorts.delete()
    log.info('Delete {0} autocreated cohorts for {1}'.format(count, instance))