code: def replace_with_background_intensity(
      metadata: Dict[str, Any], **kwargs
  ) -> float:
      """
      The intensity of replace_with_background is the fraction of the source video duration
      that was replaced with background. Because the overall duration of the video is preserved,
      the background segments together must be shorter than the source duration so the intensity is never
      greater than 100.
      """
      src_duration = metadata["src_duration"]
      total_bg_duration = (
          metadata["starting_background_duration"]
          + metadata["ending_background_duration"]
      )
      return min((total_bg_duration / src_duration) * 100.0, 100.0)
  
imports: from typing import Any, Dict, List, Optional, Tuple
  import numpy
  from augly.image import intensity, utils
  from augly.video.helpers import get_video_info
label_desc: Use image node_id 35 for calling a global function with example usage: replace_with_background_intensity(metadata) and returns: min