def METHOD_NAME(seq, channel_dim, w, h, aspect_ratio_range, area_range, value_range):
    frame_dim = 1 if channel_dim == 0 else 0
    frame_channel_dim = -1 if channel_dim == -1 else 0
    roi = None
    total_frames = seq.shape[frame_dim]
    for f in range(total_frames):
        frame = seq[:, f] if frame_dim == 1 else seq[f]
        roi = check_frame(frame, f, total_frames, frame_channel_dim, roi, w, h, aspect_ratio_range,
                          area_range, value_range)