<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_entry(self, date, entry):
 """ Add the given entry to the textual representation. """

        in_date = False
        insert_at = 0

        for (lineno, line) in enumerate(self.lines):
            # Search for the date of the entry
            if isinstance(line, DateLine) and line.date == date:
                in_date = True
                # Insert here if there is no existing Entry for this date
                insert_at = lineno
                continue

            if in_date:
                if isinstance(line, Entry):
                    insert_at = lineno
                elif isinstance(line, DateLine):
                    break

        self.lines.insert(insert_at + 1, entry)

        # If there's no other Entry in the current date, add a blank line
        # between the date and the entry
        if not isinstance(self.lines[insert_at], Entry):
            self.lines.insert(insert_at + 1, TextLine(''))