<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_task(self, ):
 """Create a task and store it in the self.task :returns: None :rtype: None :raises: None """

        depi = self.dep_cb.currentIndex()
        assert depi >= 0
        dep = self.deps[depi]
        deadline = self.deadline_de.dateTime().toPython()
        try:
            task = djadapter.models.Task(department=dep, project=self.element.project, element=self.element, deadline=deadline)
            task.save()
            self.task = task
            self.accept()
        except:
            log.exception("Could not create new task")