def METHOD_NAME(kinetics_list: str, frame_lookup: dict) -> dict:
    """Given the kinetics700 dataset list, remove the video ids from the lookup
    that are missing videos or frames.
    Args:
        kinetics_list (str): Path to the kinetics700 dataset list.
            The content of the list should be:
                ```
                Path_to_video1 label_1\n
                Path_to_video2 label_2\n
                ...
                Path_to_videon label_n\n
                ```
            The start and end of the video must be contained in the filename.
            For example:
                ```
                class602/o3lCwWyyc_s_000012_000022.mp4\n
                ```
        frame_lookup (dict): the dict from `get_kinetics_frames`.
    Returns:
        dict: the dict keys are the kinetics videos' video id. The values are
            the a list of tuples:
                (start_of_the_video, end_of_the_video, video_path)
    """
    video_lookup = defaultdict(set)
    with open(kinetics_list) as f:
        for line in f.readlines():
            video_path = line.split(' ')[0]  # remove label information
            video_name = video_path.split('/')[-1]  # get the file name
            video_name = video_name.split('.')[0]  # remove file extensions
            video_name = video_name.split('_')
            video_id = '_'.join(video_name[:-2])
            if video_id not in frame_lookup:
                continue
            start, end = int(video_name[-2]), int(video_name[-1])
            frames = frame_lookup[video_id]
            frames = [frame for frame in frames if start < frame < end]
            if len(frames) == 0:
                continue
            start, end = max(start, min(frames) - 2), min(end, max(frames) + 2)
            video_lookup[video_id].add((start, end, video_path))
    # Some frame ids exist in multiple videos in the Kinetics dataset.
    # The reason is the part of one video may fall into different categories.
    # Remove the duplicated records
    for video in video_lookup:
        if len(video_lookup[video]) == 1:
            continue
        info_list = list(video_lookup[video])
        removed_list = []
        for i, info_i in enumerate(info_list):
            start_i, end_i, _ = info_i
            for j in range(i + 1, len(info_list)):
                start_j, end_j, _ = info_list[j]
                if start_i <= start_j and end_j <= end_i:
                    removed_list.append(j)
                elif start_j <= start_i and end_i <= end_j:
                    removed_list.append(i)
        new_list = []
        for i, info in enumerate(info_list):
            if i not in removed_list:
                new_list.append(info)
        video_lookup[video] = set(new_list)
    return video_lookup