code: def load_videos(template, video_length, frame_shape):
      """Loads videos from files.
  
      Args:
        template: template string for listing the image files.
        video_length: length of the video.
        frame_shape: shape of each frame.
  
      Returns:
        dataset: the tf dataset frame by frame.
        dataset_len: number of the items which is the number of image files.
  
      Raises:
        ValueError: if no files found.
      """
      filenames = tf.gfile.Glob(template)
      if not filenames:
          raise ValueError("no files found.")
      filenames = sorted(filenames)
      dataset_len = len(filenames)
      filenames = tf.constant(filenames)
      dataset = tf.data.Dataset.from_tensor_slices(filenames)
      dataset = dataset.apply(
          tf.data.experimental.map_and_batch(
              lambda filename: load_image_map_function(
                  filename, frame_shape
              ),
              video_length,
              drop_remainder=True,
          )
      )
      return dataset, dataset_len
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import numpy
  import six
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling a global function with example usage: load_videos(template, video_length, frame_shape) and returns: dataset,  dataset_len