code: def _get_function_source_definition(func: Callable) -> str:
      """Get the source code of a function.
  
      This function is modified from KFP.  The original source is below:
      https://github.com/kubeflow/pipelines/blob/b6406b02f45cdb195c7b99e2f6d22bf85b12268b/sdk/python/kfp/components/_python_op.py#L300-L319.
      """
      func_code = inspect.getsource(func)
  
      # Function might be defined in some indented scope (e.g. in another
      # function). We need to handle this and properly dedent the function source
      # code
      func_code = textwrap.dedent(func_code)
      func_code_lines = func_code.split("\n")
  
      # For wandb, allow decorators (so we can use the @wandb_log decorator)
      func_code_lines = itertools.dropwhile(
          lambda x: not (
              x.startswith("def") or x.startswith("@wandb_log")
          ),
          func_code_lines,
      )
  
      if not func_code_lines:
          raise ValueError(
              f'Failed to dedent and clean up the source of function "{func.__name__}". '
              "It is probably not properly indented."
          )
  
      return "\n".join(func_code_lines)
  
file_path: wandb/wandb/integration/kfp/kfp_patch.py
imports: import inspect
  import itertools
  import textwrap
  from typing import Callable, List, Mapping, Optional
  from pkg_resources import parse_version
  import wandb
  from .wandb_logging import wandb_log
label_desc: Use image node_id 7 for calling a global function with example usage: _get_function_source_definition(func) and returns: str