def job_tasks(self, job_id, type=None):
path = '<STR_LIT>'.format(<EOL>jobid=job_id)<EOL>valid_types = ['<STR_LIT:m>', '<STR_LIT:r>']<EOL>if type is not None and type not in valid_types:<EOL><INDENT>msg = '<STR_LIT>' % (type,)<EOL>raise IllegalArgumentError(msg)<EOL><DEDENT>params = {}<EOL>if type is not None:<EOL><INDENT>params['<STR_LIT:type>'] = type<EOL><DEDENT>return self.request(path, **params)<EOL>
With the tasks API, you can obtain a collection of resources that
represent a task within a job.

:param str job_id: The job id
:param str type: type of task, valid values are m or r. m for map
    task or r for reduce task
:returns: API response object with JSON data
:rtype: :py:class:`yarn_api_client.base.Response`