docs: public static LambdaExecutable checkAndExtractLambda(Function function) throws TypeExtractionException {
  		try {
  			// get serialized lambda
  			SerializedLambda serializedLambda = null;
  			for (Class<?> clazz = function.getClass(); clazz != null; clazz = clazz.getSuperclass()) {
  				try {
  					Method replaceMethod = clazz.getDeclaredMethod("writeReplace");
  					replaceMethod.setAccessible(true);
  					Object serialVersion = replaceMethod.invoke(function);
  
  					// check if class is a lambda function
  					if (serialVersion != null && serialVersion.getClass() == SerializedLambda.class) {
  						serializedLambda = (SerializedLambda) serialVersion;
  						break;
  					}
  				}
  				catch (NoSuchMethodException e) {
  					// thrown if the method is not there. fall through the loop
  				}
  			}
  
  			// not a lambda method -> return null
  			if (serializedLambda == null) {
  				return null;
  			}
  
  			// find lambda method
  			String className = serializedLambda.getImplClass();
  			String methodName = serializedLambda.getImplMethodName();
  			String methodSig = serializedLambda.getImplMethodSignature();
  
  			Class<?> implClass = Class.forName(className.replace('/', '.'), true, Thread.currentThread().getContextClassLoader());
  
  			// find constructor
  			if (methodName.equals("<init>")) {
  				Constructor<?>[] constructors = implClass.getDeclaredConstructors();
  				for (Constructor<?> constructor : constructors) {
  					if (getConstructorDescriptor(constructor).equals(methodSig)) {
  						return new LambdaExecutable(constructor);
  					}
  				}
  			}
  			// find method
  			else {
  				List<Method> methods = getAllDeclaredMethods(implClass);
  				for (Method method : methods) {
  					if (method.getName().equals(methodName) && getMethodDescriptor(method).equals(methodSig)) {
  						return new LambdaExecutable(method);
  					}
  				}
  			}
  			throw new TypeExtractionException("No lambda method found.");
  		}
  		catch (Exception e) {
  			throw new TypeExtractionException("Could not extract lambda method out of function: " +
  				e.getClass().getSimpleName() + " - " + e.getMessage(), e);
  		}
  	}