code: def build_doc(doc, opts):
      """Build docstring from doc and options
  
      Parameters
      ----------
      rep_doc : string
          Documentation string
      opts : dict
          Dictionary of option attributes and keys.  Use reverse_opt_map
          to reverse flags and attrs from opt_map class attribute.
  
      Returns
      -------
      newdoc : string
          The docstring with flags replaced with attribute names and
          formatted to match nipy standards (as best we can).
  
      """
  
      # Split doc into line elements.  Generally, each line is an
      # individual flag/option.
      doclist = doc.split("\n")
      newdoc = []
      flags_doc = []
      for line in doclist:
          linelist = line.split()
          if not linelist:
              # Probably an empty line
              continue
          # For lines we care about, the first item is the flag
          if (
              "," in linelist[0]
          ):  # sometimes flags are only separated by comma
              flag = linelist[0].split(",")[0]
          else:
              flag = linelist[0]
          attr = opts.get(flag)
          if attr is not None:
              # newline = line.replace(flag, attr)
              # Replace the flag with our attribute name
              linelist[0] = "%s :\n    " % str(attr)
              # Add some line formatting
              newline = " ".join(linelist)
              newdoc.append(newline)
          else:
              if line[0].isspace():
                  # For all the docs I've looked at, the flags all have
                  # indentation (spaces) at the start of the line.
                  # Other parts of the docs, like 'usage' statements
                  # start with alphanumeric characters.  We only care
                  # about the flags.
                  flags_doc.append(line)
      return format_params(newdoc, flags_doc)
  
file_path: nipype/nipype/utils/docparse.py
imports: import subprocess
  from ..interfaces.base import CommandLine
  from .misc import is_container
label_desc: Use image node_id 5 for calling a global function with example usage: build_doc(doc, opts) and returns: format_params