I'm not sure if it's faster to do this in the db or in Python, but it looks like you could reuse the query you're using below to do this check instead of using a `for` loop:
```
MidcourseReverificationWindow.objects.filter(course_id=self.course_id, start_date__lte=date, end_date__gte=date)
```