code: def funcname(func):
      """Get the name of a function."""
      # functools.partial
      if isinstance(func, functools.partial):
          return funcname(func.func)
      # methodcaller
      if isinstance(func, methodcaller):
          return str(func)[:50]
  
      module_name = getattr(func, "__module__", None) or ""
      type_name = getattr(type(func), "__name__", None) or ""
  
      # cytoolz.curry
      if "cytoolz" in module_name and type_name == "curry":
          return func.func_name[:50]
      # numpy.vectorize objects
      if "numpy" in module_name and type_name == "vectorize":
          return ("vectorize_" + funcname(func.pyfunc))[:50]
  
      # All other callables
      try:
          name = func.__name__
          if name == "<lambda>":
              return "lambda"
          return name[:50]
      except AttributeError:
          return str(func)[:50]
  
file_path: lightning-flash/src/flash/core/serve/dag/utils.py
imports: import functools
  import re
  from operator import methodcaller
  from flash.core.utilities.imports import _TOPIC_SERVE_AVAILABLE
label_desc: Use image node_id 1 for calling a global function with example usage: funcname(func) and returns: funcname, str, func, unknown, name, str, str