code: def is_complete_dir(video_dir, layers=DEFAULT_LAYERS):
      video_dir = as_path(video_dir)
      filenames = [d.name for d in video_dir.iterdir()]
      if not (
          "data_ranges.json" in filenames
          and "metadata.json" in filenames
          and "events.json" in filenames
      ):
          return False
      nr_frames_per_category = {
          key: len([fn for fn in filenames if fn.startswith(key)])
          for key in layers
      }
  
      nr_expected_frames = nr_frames_per_category["rgba"]
      if nr_expected_frames == 0:
          return False
      if not all(
          nr_frames == nr_expected_frames
          for nr_frames in nr_frames_per_category.values()
      ):
          return False
  
      return True
  
imports: import dataclasses
  import json
  import logging
  import imageio
  import numpy
  import png
  import tensorflow
  import tensorflow_datasets.public_api
  from typing import List, Dict, Union
label_desc: Use image node_id 11 for calling a global function with example usage: is_complete_dir(video_dir, layers) and returns: True, False, False, False