code: def main(func_name, prefix, errors, output_format, ignore_deprecated):
      def header(title, width=80, char="#"):
          full_line = char * width
          side_len = (width - len(title) - 2) // 2
          adj = "" if len(title) % 2 == 0 else " "
          title_line = "{side} {title}{adj} {side}".format(
              side=char * side_len, title=title, adj=adj
          )
  
          return "\n{full_line}\n{title_line}\n{full_line}\n\n".format(
              full_line=full_line, title_line=title_line
          )
  
      exit_status = 0
      if func_name is None:
          result = validate_all(prefix, ignore_deprecated)
  
          if output_format == "json":
              output = json.dumps(result)
          else:
              if output_format == "default":
                  output_format = "{text}\n"
              elif output_format == "azure":
                  output_format = (
                      "##vso[task.logissue type=error;"
                      "sourcepath={path};"
                      "linenumber={row};"
                      "code={code};"
                      "]{text}\n"
                  )
              else:
                  raise ValueError(
                      f'Unknown output_format "{output_format}"'
                  )
  
              output = []
              for name, res in result.items():
                  for err_code, err_desc in res["errors"]:
                      # The script would be faster if instead of filtering the
                      # errors after validating them, it didn't validate them
                      # initially. But that would complicate the code too much
                      if errors and err_code not in errors:
                          continue
                      exit_status += 1
                      output.append(
                          output_format.format(
                              name=name,
                              path=res["file"],
                              row=res["file_line"],
                              code=err_code,
                              text=f"{name}: {err_desc}",
                          )
                      )
          output = "".join(sorted(output))
          sys.stdout.write(output)
  
      else:
          result = validate_one(func_name)
          sys.stderr.write(header(f"Docstring ({func_name})"))
          sys.stderr.write("{}\n".format(result["docstring"]))
          sys.stderr.write(header("Validation"))
          if result["errors"]:
              sys.stderr.write(
                  "{} Errors found:\n".format(len(result["errors"]))
              )
              for err_code, err_desc in result["errors"]:
                  # Failing examples are printed at the end
                  if err_code == "EX02":
                      sys.stderr.write("\tExamples do not pass tests\n")
                      continue
                  sys.stderr.write(f"\t{err_desc}\n")
          if result["warnings"]:
              sys.stderr.write(
                  "{} Warnings found:\n".format(len(result["warnings"]))
              )
              for wrn_code, wrn_desc in result["warnings"]:
                  sys.stderr.write(f"\t{wrn_desc}\n")
  
          if not result["errors"]:
              sys.stderr.write(
                  f'Docstring for "{func_name}" correct. :)\n'
              )
  
          if result["examples_errors"]:
              sys.stderr.write(header("Doctests"))
              sys.stderr.write(result["examples_errors"])
  
      return exit_status
  
imports: import argparse
  import ast
  import collections
  import doctest
  import functools
  import glob
  import importlib
  import inspect
  from io import StringIO
  import json
  import os
  import pydoc
  import re
  import string
  import sys
  import tempfile
  import textwrap
  import flake8.main.application
  import matplotlib
  import numpy
  from numpydoc.docscrape import NumpyDocString
  import pandas
  from pandas.io.formats.printing import pprint_thing
  import statsmodels.api
label_desc: Use image node_id 6 for calling a global function with example usage: main(func_name, prefix, errors, output_format, ignore_deprecated) and returns: exit_status, str