code: def check_valid_m3u8(file=""):
      """
      checks if given file is a valid M3U8 file
      """
      if not file or not os.path.isfile(file):
          logger.error("No file provided")
          return False
      metas = []
      try:
          data = open(file).read()
          playlist = m3u8.loads(data)
          if playlist.is_variant:
              for pl in playlist.playlists:
                  meta = {}
                  meta["resolution"] = pl.stream_info.resolution
                  meta["framerate"] = pl.stream_info.frame_rate
                  metas.append(meta)
          else:
              for seg in playlist.segments:
                  metas.append(extract_meta_video(seg))
      except Exception as e:
          logger.error(str(e))
          return False
      return metas
  
imports: import os
  import cv2
  import queue
  import pytest
  import m3u8
  import logging
  import platform
  import tempfile
  from mpegdash.parser import MPEGDASHParser
  from vidgear.gears import CamGear, StreamGear
  from vidgear.gears.helper import logger_handler, validate_video
label_desc: Use image node_id 5 for calling a global function with example usage: check_valid_m3u8(file) and returns: metas, False, False