code: def extract_lambda_source(f):
      """Extracts a single lambda expression from the string source. Returns a
      string indicating an unknown body if it gets confused in any way.
  
      This is not a good function and I am sorry for it. Forgive me my
      sins, oh lord
      """
      # You might be wondering how a lambda can have a return-type annotation?
      # The answer is that we add this at runtime, in new_given_signature(),
      # and we do support strange choices as applying @given() to a lambda.
      sig = inspect.signature(f)
      assert sig.return_annotation in (
          inspect.Parameter.empty,
          None,
      ), sig
  
      if sig.parameters:
          if_confused = f"lambda {str(sig)[1:-1]}: <unknown>"
      else:
          if_confused = "lambda: <unknown>"
      try:
          source = inspect.getsource(f)
      except OSError:
          return if_confused
  
      source = LINE_CONTINUATION.sub(" ", source)
      source = WHITESPACE.sub(" ", source)
      source = source.strip()
      if (
          "lambda" not in source and sys.platform == "emscripten"
      ):  # pragma: no cover
          return if_confused  # work around Pyodide bug in inspect.getsource()
      assert "lambda" in source
  
      tree = None
  
      try:
          tree = ast.parse(source)
      except SyntaxError:
          for i in range(len(source) - 1, len("lambda"), -1):
              prefix = source[:i]
              if "lambda" not in prefix:
                  break
              try:
                  tree = ast.parse(prefix)
                  source = prefix
                  break
              except SyntaxError:
                  continue
      if tree is None and source.startswith(("@", ".")):
          # This will always eventually find a valid expression because the
          # decorator or chained operator must be a valid Python function call,
          # so will eventually be syntactically valid and break out of the loop.
          # Thus, this loop can never terminate normally.
          for i in range(len(source) + 1):
              p = source[1:i]
              if "lambda" in p:
                  try:
                      tree = ast.parse(p)
                      source = p
                      break
                  except SyntaxError:
                      pass
          else:
              raise NotImplementedError("expected to be unreachable")
  
      if tree is None:
          return if_confused
  
      aligned_lambdas = extract_all_lambdas(
          tree, matching_signature=sig
      )
      if len(aligned_lambdas) != 1:
          return if_confused
      lambda_ast = aligned_lambdas[0]
      assert lambda_ast.lineno == 1
  
      # If the source code contains Unicode characters, the bytes of the original
      # file don't line up with the string indexes, and `col_offset` doesn't match
      # the string we're using.  We need to convert the source code into bytes
      # before slicing.
      #
      # Under the hood, the inspect module is using `tokenize.detect_encoding` to
      # detect the encoding of the original source file.  We'll use the same
      # approach to get the source code as bytes.
      #
      # See https://github.com/HypothesisWorks/hypothesis/issues/1700 for an
      # example of what happens if you don't correct for this.
      #
      # Note: if the code doesn't come from a file (but, for example, a doctest),
      # `getsourcefile` will return `None` and the `open()` call will fail with
      # an OSError.  Or if `f` is a built-in function, in which case we get a
      # TypeError.  In both cases, fall back to splitting the Unicode string.
      # It's not perfect, but it's the best we can do.
      try:
          with open(inspect.getsourcefile(f), "rb") as src_f:
              encoding, _ = detect_encoding(src_f.readline)
  
          source_bytes = source.encode(encoding)
          source_bytes = source_bytes[lambda_ast.col_offset :].strip()
          source = source_bytes.decode(encoding)
      except (OSError, TypeError):
          source = source[lambda_ast.col_offset :].strip()
  
      # This ValueError can be thrown in Python 3 if:
      #
      #  - There's a Unicode character in the line before the Lambda, and
      #  - For some reason we can't detect the source encoding of the file
      #
      # because slicing on `lambda_ast.col_offset` will account for bytes, but
      # the slice will be on Unicode characters.
      #
      # In practice this seems relatively rare, so we just give up rather than
      # trying to recover.
      try:
          source = source[source.index("lambda") :]
      except ValueError:
          return if_confused
  
      for i in range(
          len(source), len("lambda"), -1
      ):  # pragma: no branch
          try:
              parsed = ast.parse(source[:i])
              assert len(parsed.body) == 1
              assert parsed.body
              if isinstance(parsed.body[0].value, ast.Lambda):
                  source = source[:i]
                  break
          except SyntaxError:
              pass
      lines = source.split("\n")
      lines = [PROBABLY_A_COMMENT.sub("", l) for l in lines]
      source = "\n".join(lines)
  
      source = WHITESPACE.sub(" ", source)
      source = SPACE_FOLLOWS_OPEN_BRACKET.sub("(", source)
      source = SPACE_PRECEDES_CLOSE_BRACKET.sub(")", source)
      return source.strip()
  
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 13 for calling a global function with example usage: extract_lambda_source(f) and returns: source, if_confused, if_confused, if_confused, if_confused, if_confused