<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_name_on_date(self, date):
 """ Get the name of a company on a given date. This takes into accounts and name changes that may have occurred. """

        if date is None:
            return self.name

        post_name_changes = CompanyNameChange.objects.filter(company=self,
                                                             date__gte=date).order_by('date')
        if post_name_changes.count() == 0:
            return self.name
        else:
            return post_name_changes[0].name_before