code: def _capture_as_text(capture: Callable[..., Any]) -> str:
      
      if not icontract._represent._is_lambda(a_function=capture):
          signature = inspect.signature(capture)
          param_names = list(signature.parameters.keys())
  
          return "{}({})".format(capture.__qualname__, ", ".join(param_names))
  
      lines, lineno = inspect.findsource(capture)
      filename = inspect.getsourcefile(capture)
      decorator_inspection = icontract._represent.inspect_decorator(lines=lines, lineno=lineno, filename=filename)
  
      call_node = decorator_inspection.node
  
      capture_node = None  # type: Optional[ast.Lambda]
  
      if len(call_node.args) > 0:
          assert isinstance(call_node.args[0], ast.Lambda), \
              ("Expected the first argument to the snapshot decorator to be a condition as lambda AST node, "
               "but got: {}").format(type(call_node.args[0]))
  
          capture_node = call_node.args[0]
  
      elif len(call_node.keywords) > 0:
          for keyword in call_node.keywords:
              if keyword.arg == "capture":
                  assert isinstance(keyword.value, ast.Lambda), \
                      "Expected lambda node as value of the 'capture' argument to the decorator."
  
                  capture_node = keyword.value
                  break
  
          assert capture_node is not None, "Expected to find a keyword AST node with 'capture' arg, but found none"
      else:
          raise AssertionError(
              "Expected a call AST node of a snapshot decorator to have either args or keywords, but got: {}".format(
                  ast.dump(call_node)))
  
      capture_text = decorator_inspection.atok.get_text(capture_node.body)
  
      return capture_text
docs: Convert the capture function into its text representation by parsing the source code of the decorator.