code: def apply_lambda(
      video_path: str,
      output_path: Optional[str] = None,
      aug_function: Callable[..., Any] = helpers.identity_function,
      metadata: Optional[List[Dict[str, Any]]] = None,
      **kwargs,
  ) -> str:
      """
      Apply a user-defined lambda on a video
  
      @param video_path: the path to the video to be augmented
  
      @param output_path: the path in which the resulting video will be stored.
          If not passed in, the original video file will be overwritten
  
      @param aug_function: the augmentation function to be applied onto the video
          (should expect a video path and output path as input and output the augmented
          video to the output path. Nothing needs to be returned)
  
      @param metadata: if set to be a list, metadata about the function execution
          including its name, the source & dest duration, fps, etc. will be appended
          to the inputted list. If set to None, no metadata will be appended or returned
  
      @param **kwargs: the input attributes to be passed into `aug_function`
  
      @returns: the path to the augmented video
      """
      assert callable(aug_function), (
          repr(type(aug_function).__name__) + " object is not callable"
      )
  
      func_kwargs = helpers.get_func_kwargs(
          metadata,
          locals(),
          video_path,
          aug_function=aug_function.__name__,
      )
  
      aug_function(video_path, output_path or video_path, **kwargs)
  
      if metadata is not None:
          helpers.get_metadata(
              metadata=metadata,
              function_name="apply_lambda",
              **func_kwargs,
          )
  
      return output_path or video_path
  
imports: import functools
  import math
  import os
  import shutil
  import tempfile
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  from augly import audio, image, utils
  from augly.audio import utils
  from augly.video import helpers, utils
  from augly.video.augmenters import cv2, ffmpeg
label_desc: Use image node_id 2 for calling a global function with example usage: apply_lambda(video_path, output_path, aug_function, metadata) and returns: unknown