<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _tasks_to_reinsert(tasks, transactional):
 """Return a list containing the tasks that should be reinserted based on the was_enqueued property and whether the insert is transactional or not. """

    if transactional:
        return tasks

    return [task for task in tasks if not task.was_enqueued]