human
Complete this python program:
def fill_cache(visited_list, video_file_path, timestamps, q, seek_idx, run, min_marker_perimeter, invert_image):
assistant
#Here is the Python code you requested.

    """this function is part of marker_detector it is run as a seperate process.
    it must be kept in a seperate file for namespace sanatisation
    """
    import os
    import logging
    logger = logging.getLogger(((__name__ + '    with    pid:    ') + str(os.getpid())))
    logger.debug('Started    cacher    process    for    Marker    Detector')
    import cv2
    from video_capture import File_Source, EndofVideoFileError, FileSeekError
    from square_marker_detect import detect_markers_robust
    aperture = 9
    markers = []
    cap = File_Source(Global_Container(), video_file_path, timestamps=timestamps)
    def next_unvisited_idx(frame_idx):
        try:
            visited = visited_list[frame_idx]
        except IndexError:
            visited = True
        if (not visited):
            next_unvisited = frame_idx
        else:
            try:
                next_unvisited = visited_list.index(False, frame_idx)
            except ValueError:
                try:
                    next_unvisited = visited_list.index(False, 0, frame_idx)
                except ValueError:
                    logger.debug('Caching    completed.')
                    next_unvisited = None
        return next_unvisited
    def handle_frame(next_frame):
        if (next_frame != cap.get_frame_index()):
            logger.debug('Seeking    to    Frame    {}'.format(next_frame))
            try:
                cap.seek_to_frame(next_frame)
            except FileSeekError:
                logger.warning('Could    not    evaluate    frame:    {}.'.format(next_frame))
                visited_list[next_frame] = True
                q.put((next_frame, []))
                return
            markers[:] = []
        try:
            frame = cap.get_frame()
        except EndofVideoFileError:
            logger.debug("Video    File's    last    frame(s)    not    accesible")
            logger.warning('Could    not    evaluate    frame:    {}.'.format(next_frame))
            visited_list[next_frame] = True
            q.put((next_frame, []))
            return
        markers[:] = detect_markers_robust(frame.gray, grid_size=5, prev_markers=markers,...