code: def function_digest(function):
      """Returns a string that is stable across multiple invocations across
      multiple processes and is prone to changing significantly in response to
      minor changes to the function.
  
      No guarantee of uniqueness though it usually will be. Digest collisions
      lead to unfortunate but not fatal problems during database replay.
      """
      hasher = hashlib.sha384()
      try:
          src = inspect.getsource(function)
      except (OSError, TypeError):
          # If we can't actually get the source code, try for the name as a fallback.
          # NOTE: We might want to change this to always adding function.__qualname__,
          # to differentiate f.x. two classes having the same function implementation
          # with class-dependent behaviour.
          try:
              hasher.update(function.__name__.encode())
          except AttributeError:
              pass
      else:
          hasher.update(_clean_source(src))
      try:
          # This is additional to the source code because it can include the effects
          # of decorators, or of post-hoc assignment to the .__signature__ attribute.
          hasher.update(repr(get_signature(function)).encode())
      except Exception:
          pass
      try:
          # We set this in order to distinguish e.g. @pytest.mark.parametrize cases.
          hasher.update(function._hypothesis_internal_add_digest)
      except AttributeError:
          pass
      return hasher.digest()
  
imports: import ast
  import hashlib
  import inspect
  import os
  import re
  import sys
  import textwrap
  import types
  from functools import wraps
  from io import StringIO
  from keyword import iskeyword
  from tokenize import COMMENT, detect_encoding, generate_tokens, untokenize
  from types import ModuleType
  from typing import TYPE_CHECKING, Any, Callable
  from unittest.mock import _patch
  from hypothesis.internal.compat import PYPY, is_typed_named_tuple
  from hypothesis.utils.conventions import not_set
  from hypothesis.vendor.pretty import pretty
label_desc: Use image node_id 3 for calling a global function with example usage: function_digest(function) and returns: hasher