code: def process_output(self, data, output_prompt,
                         input_lines, output, is_doctest, decorator, image_file):
          
          TAB = ' ' * 4
  
          if is_doctest and output is not None:
  
              found = output
              found = found.strip()
              submitted = data.strip()
  
              if self.directive is None:
                  source = 'Unavailable'
                  content = 'Unavailable'
              else:
                  source = self.directive.state.document.current_source
                  content = self.directive.content
                  # Add tabs and join into a single string.
                  content = '\n'.join([TAB + line for line in content])
  
              # Make sure the output contains the output prompt.
              ind = found.find(output_prompt)
              if ind < 0:
                  e = ('output does not contain output prompt\n\n'
                       'Document source: {0}\n\n'
                       'Raw content: \n{1}\n\n'
                       'Input line(s):\n{TAB}{2}\n\n'
                       'Output line(s):\n{TAB}{3}\n\n')
                  e = e.format(source, content, '\n'.join(input_lines),
                               repr(found), TAB=TAB)
                  raise RuntimeError(e)
              found = found[len(output_prompt):].strip()
  
              # Handle the actual doctest comparison.
              if decorator.strip() == '@doctest':
                  # Standard doctest
                  if found != submitted:
                      e = ('doctest failure\n\n'
                           'Document source: {0}\n\n'
                           'Raw content: \n{1}\n\n'
                           'On input line(s):\n{TAB}{2}\n\n'
                           'we found output:\n{TAB}{3}\n\n'
                           'instead of the expected:\n{TAB}{4}\n\n')
                      e = e.format(source, content, '\n'.join(input_lines),
                                   repr(found), repr(submitted), TAB=TAB)
                      raise RuntimeError(e)
              else:
                  self.custom_doctest(decorator, input_lines, found, submitted)
docs: Process data block for OUTPUT token.