def parameterize_notebook(nb, parameters, report_mode=False):
<EOL>if isinstance(parameters, six.string_types):<EOL><INDENT>parameters = read_yaml_file(parameters)<EOL><DEDENT>nb = copy.deepcopy(nb)<EOL>kernel_name = nb.metadata.kernelspec.name<EOL>language = nb.metadata.kernelspec.language<EOL>param_content = translate_parameters(kernel_name, language, parameters)<EOL>newcell = nbformat.v4.new_code_cell(source=param_content)<EOL>newcell.metadata['<STR_LIT>'] = ['<STR_LIT>']<EOL>if report_mode:<EOL><INDENT>newcell.metadata['<STR_LIT>'] = newcell.get('<STR_LIT>', {})<EOL>newcell.metadata['<STR_LIT>']['<STR_LIT>'] = True<EOL><DEDENT>param_cell_index = _find_first_tagged_cell_index(nb, '<STR_LIT>')<EOL>injected_cell_index = _find_first_tagged_cell_index(nb, '<STR_LIT>')<EOL>if injected_cell_index >= <NUM_LIT:0>:<EOL><INDENT>before = nb.cells[:injected_cell_index]<EOL>after = nb.cells[injected_cell_index + <NUM_LIT:1> :]<EOL><DEDENT>elif param_cell_index >= <NUM_LIT:0>:<EOL><INDENT>before = nb.cells[: param_cell_index + <NUM_LIT:1>]<EOL>after = nb.cells[param_cell_index + <NUM_LIT:1> :]<EOL><DEDENT>else:<EOL><INDENT>logger.warning("<STR_LIT>")<EOL>before = []<EOL>after = nb.cells<EOL><DEDENT>nb.cells = before + [newcell] + after<EOL>nb.metadata.papermill['<STR_LIT>'] = parameters<EOL>return nb<EOL>
Assigned parameters into the appropriate place in the input notebook

    Parameters
    ----------
    nb : NotebookNode
       Executable notebook object
    parameters : dict
       Arbitrary keyword arguments to pass as notebook parameters
    report_mode : bool, optional
       Flag to set report mode