def to_task(self, vtodo, project=None, uuid=None):
        """Add or modify a task from vTodo to Taskwarrior
        vtodo -- the vTodo to add
        project -- the project to add (see get_filesnames() as well)
        uuid -- the UID of the task in Taskwarrior
        """
        task = {}

        if project and project != 'all_projects' and project != 'unaffiliated':
            task['project'] = project

        if uuid:
            task['uuid'] = uuid

        if hasattr(vtodo, 'dtstamp'):
            task['entry'] = self._tw_timestamp(vtodo.dtstamp.value)

        if hasattr(vtodo, 'last_modified'):
            task['modified'] = self._tw_timestamp(vtodo.last_modified.value)

        if hasattr(vtodo, 'dtstart'):
            task['start'] = self._tw_timestamp(vtodo.dtstart.value)

        if hasattr(vtodo, 'due'):
            task['due'] = self._tw_timestamp(vtodo.due.value)

        if hasattr(vtodo, 'completed'):
            task['end'] = self._tw_timestamp(vtodo.completed.value)

        task['description'] = vtodo.summary.value

        if hasattr(vtodo, 'categories'):
            task['tags'] = vtodo.categories.value

        if hasattr(vtodo, 'priority'):
            priority = int(vtodo.priority.value)
            if priority < 3:
                task['priority'] = 'H'
            elif 3 < priority < 7:
                task['priority'] = 'M'
            else:
                task['priority'] = 'L'

        if hasattr(vtodo, 'description'):
            task['annotations'] = []
            for delta, comment in enumerate(vtodo.description.value.split('\n')):
                # Hack because Taskwarrior import doesn't accept multiple annotations with the same timestamp
                stamp = self._tw_timestamp(vtodo.dtstamp.value + timedelta(seconds=delta))
                if uuid in self._tasks.get(project, {}) and 'annotations' in self._tasks[project][uuid]:
                    for annotation in self._tasks[project][uuid]['annotations']:
                        if annotation['description'] == comment:
                            stamp = annotation['entry']
                            break
                task['annotations'].append({'entry': stamp, 'description': comment})

        if hasattr(vtodo, 'status'):
            if vtodo.status.value == 'IN-PROCESS':
                task['status'] = 'pending'
                if 'start' not in task:
                    task['start'] = self._tw_timestamp(vtodo.dtstamp.value)
            elif vtodo.status.value == 'NEEDS-ACTION':
                task['status'] = 'pending'
            elif vtodo.status.value == 'COMPLETED':
                task['status'] = 'completed'
                if 'end' not in task:
                    task['end'] = self._tw_timestamp(vtodo.dtstamp.value)
            elif vtodo.status.value == 'CANCELLED':
                task['status'] = 'deleted'
                if 'end' not in task:
                    task['end'] = self._tw_timestamp(vtodo.dtstamp.value)

        json = dumps(task, separators=(',', ':'), sort_keys=True)
        with self._lock:
            p = run(['task', 'rc.verbose=nothing', 'rc.recurrence.confirmation=no', 'rc.data.location={self._data_location}'.format(**locals()), 'import', '-'], input=json, encoding='utf-8', stdout=PIPE)
        uuid = findall('(?:add|mod)  ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}) ', p.stdout)[0]
        self._update()
        return self._gen_uid(uuid)
Add or modify a task from vTodo to Taskwarrior
        vtodo -- the vTodo to add
        project -- the project to add (see get_filesnames() as well)
        uuid -- the UID of the task in Taskwarrior