code: def prepare_notebook_metadata(nb, input_path, output_path, report_mode=False):
      
      # Copy the nb object to avoid polluting the input
      nb = copy.deepcopy(nb)
  
      # Hide input if report-mode is set to True.
      if report_mode:
          for cell in nb.cells:
              if cell.cell_type == 'code':
                  cell.metadata['jupyter'] = cell.get('jupyter', {})
                  cell.metadata['jupyter']['source_hidden'] = True
  
      # Record specified environment variable values.
      nb.metadata.papermill['input_path'] = input_path
      nb.metadata.papermill['output_path'] = output_path
  
      return nb
docs: Prepare metadata associated with a notebook and its cells
  
      Parameters
      ----------
      nb : NotebookNode
         Executable notebook object
      input_path : str
          Path to input notebook
      output_path : str
         Path to write executed notebook
      report_mode : bool, optional
         Flag to set report mode