<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def task_date(self, task_re):
 """ Get a datetime.date object for the last task that matches a regex. :param task_re: regex, eg re.compile('Development Freeze'). See txproductpages.milestones for some useful regex constants to pass in here. :returns: deferred that when fired returns a datetime.date object :raises: TaskNotFoundException if no tasks matched. """

        tasks = yield self.schedule_tasks()
        task_date = None
        for task in tasks:
            if task_re.match(task['name']):
                (y, m, d) = task['date_finish'].split('-')
                task_date = date(int(y), int(m), int(d))
        if task_date:
            defer.returnValue(task_date)
        raise TaskNotFoundException()