code: def find_functions(filename, tag="API"):
      """
      Scan the file, looking for tagged functions.
  
      Assuming ``tag=='API'``, a tagged function looks like::
  
          /*API*/
          static returntype*
          function_name(argtype1 arg1, argtype2 arg2)
          {
          }
  
      where the return type must be on a separate line, the function
      name must start the line, and the opening ``{`` must start the line.
  
      An optional documentation comment in ReST format may follow the tag,
      as in::
  
          /*API
            This function does foo...
           */
      """
      if filename.endswith((".c.src", ".h.src")):
          fo = io.StringIO(process_c_file(filename))
      else:
          fo = open(filename, "r")
      functions = []
      return_type = None
      function_name = None
      function_args = []
      doclist = []
      SCANNING, STATE_DOC, STATE_RETTYPE, STATE_NAME, STATE_ARGS = list(
          range(5)
      )
      state = SCANNING
      tagcomment = "/*" + tag
      for lineno, line in enumerate(fo):
          try:
              line = line.strip()
              if state == SCANNING:
                  if line.startswith(tagcomment):
                      if line.endswith("*/"):
                          state = STATE_RETTYPE
                      else:
                          state = STATE_DOC
              elif state == STATE_DOC:
                  if line.startswith("*/"):
                      state = STATE_RETTYPE
                  else:
                      line = line.lstrip(" *")
                      doclist.append(line)
              elif state == STATE_RETTYPE:
                  # first line of declaration with return type
                  m = re.match(r"NPY_NO_EXPORT\s+(.*)$", line)
                  if m:
                      line = m.group(1)
                  return_type = line
                  state = STATE_NAME
              elif state == STATE_NAME:
                  # second line, with function name
                  m = re.match(r"(\w+)\s*\(", line)
                  if m:
                      function_name = m.group(1)
                  else:
                      raise ParseError(
                          filename,
                          lineno + 1,
                          "could not find function name",
                      )
                  function_args.append(line[m.end() :])
                  state = STATE_ARGS
              elif state == STATE_ARGS:
                  if line.startswith("{"):
                      # finished
                      # remove any white space and the closing bracket:
                      fargs_str = (
                          " ".join(function_args).rstrip()[:-1].rstrip()
                      )
                      fargs = split_arguments(fargs_str)
                      f = Function(
                          function_name,
                          return_type,
                          fargs,
                          "\n".join(doclist),
                      )
                      functions.append(f)
                      return_type = None
                      function_name = None
                      function_args = []
                      doclist = []
                      state = SCANNING
                  else:
                      function_args.append(line)
          except ParseError:
              raise
          except Exception as e:
              msg = "see chained exception for details"
              raise ParseError(filename, lineno + 1, msg) from e
      fo.close()
      return functions
  
imports: import hashlib
  import io
  import os
  import re
  import sys
  import importlib.util
  import textwrap
  from os.path import join
label_desc: Use image node_id 7 for calling a global function with example usage: find_functions(filename, tag) and returns: functions