How to color code strips in blender VSE?
The following code creates a color strip of the same length as the selection, puts it in channel 1 and creates a metastrip. It's a bare code with no checks of whatever. Hope this can get you on the way.
To test the code: open the scripting workspace and create a new text block. Copy the code in the text block. Select 1 or more clips in the video sequencer and run the code.
import bpy

sel_strips= bpy.context.selected_sequences


first_frame = 9999
last_frame = 0

#calculate first and last frame of selected strips to set the length of the color strip
for strip in sel_strips:
    if strip.frame_final_start &lt; first_frame:
        first_frame = strip.frame_final_start
    if strip.frame_final_end &gt; last_frame:
        last_frame = strip.frame_final_end


#the color strip is always put in channel 1; no check for replace or whatever
color_strip = bpy.context.scene.sequence_editor.sequences.new_effect(name='test', type='COLOR', frame_start=first_frame, frame_end=last_frame, channel=1)
#the color is set to red
color_strip.color = (1,0,0)

#this operator creates the metastrip
bpy.ops.sequencer.meta_make()