def _delete_tasks(config, task_id, limit=<NUM_LIT:100>, offset=<NUM_LIT:0>):
try:<EOL><INDENT>project = find_project_by_short_name(config.project['<STR_LIT>'],<EOL>config.pbclient,<EOL>config.all)<EOL>if task_id:<EOL><INDENT>response = config.pbclient.delete_task(task_id)<EOL>check_api_error(response)<EOL>return "<STR_LIT>" % task_id<EOL><DEDENT>else:<EOL><INDENT>limit = limit<EOL>offset = offset<EOL>tasks = config.pbclient.get_tasks(project.id, limit, offset)<EOL>while len(tasks) > <NUM_LIT:0>:<EOL><INDENT>for t in tasks:<EOL><INDENT>response = config.pbclient.delete_task(t.id)<EOL>check_api_error(response)<EOL><DEDENT>offset += limit<EOL>tasks = config.pbclient.get_tasks(project.id, limit, offset)<EOL><DEDENT>return "<STR_LIT>"<EOL><DEDENT><DEDENT>except exceptions.ConnectionError:<EOL><INDENT>return ("<STR_LIT>" % config.server)<EOL><DEDENT>except (ProjectNotFound, TaskNotFound):<EOL><INDENT>raise<EOL><DEDENT>
Delete tasks from a project.