code: def process_f2pydoc(f2pydoc):
      
      # ---- split f2py document in its parts
      # 0=Call Signature
      # 1=Parameters
      # 2=Other (optional) Parameters (only if present)
      # 3=Returns
      docparts = re.split('\n--', f2pydoc)
  
      if len(docparts) == 4:
          doc_has_optionals = True
      elif len(docparts) == 3:
          doc_has_optionals = False
      else:
          print('-- uninterpretable f2py documentation --')
          return f2pydoc
  
      # ---- replace arguments with _d suffix with empty string in ----
      # ---- function signature (remove them): ----
      docparts[0] = re.sub('[\[(,]\w+_d\d', '', docparts[0])
  
      # ---- replace _d arguments of the return arrays with their default value:
      if doc_has_optionals:
  
          returnarray_dims = re.findall('[\[(,](\w+_d\d)', docparts[3])
          for arg in returnarray_dims:
              searchpattern = arg + ' : input.*\n.*Default: (.*)\n'
              match = re.search(searchpattern, docparts[2])
              if match:
                  default = match.group(1)
                  docparts[3] = re.sub(arg, default, docparts[3])
                  docparts[2] = re.sub(searchpattern, '', docparts[2])
  
      # ---- remove all optional _d# from optional argument list:
      if doc_has_optionals:
          searchpattern = '\w+_d\d : input.*\n.*Default: (.*)\n'
          docparts[2] = re.sub(searchpattern, '', docparts[2])
  
      # ---- combine doc parts to a single string
      processed_signature = '\n--'.join(docparts)
  
      return processed_signature
docs: this function replace all optional _d0 arguments with their default values
      in the function signature. These arguments are not intended to be used and
      signify merely the array dimensions of the associated argument.