Script that make custom properties from shape key

hi,
how i can write a script that take all my shape key and make from them a custom properties on the same object?

if somebody also know how to change the name of a custom properties in script it will be also good

well, finally i was able to make the script work, its not the best but its work!
the script make a custom properties on an object based on the shapes keys, and then add driver to the shape keys base on the custom properties, i post it here if somebody also will need it to save some time:


#the script take all the shape key and add a custom property withe the name of the shape keys
#and add to the shape key a driver from the custom property

#check the first and last shape key "frame" in the last windows that you want to work on and copy it without the last zero
#if the frame is 120, take the number 12. take this numbers and write it in D, the first number and the last number
#run the script and you will get all the coustom properties and driver on the selected object.
#select the eye controller and serach for the eye KeyShape Name (Key.001) and write it in A
#delete from the code C part (until "End of c")
#run the code again, and select all the other object you want and do it again


import bpy

context = bpy.context
obj = context.object

#go on all keys
#-------D---D--Dkeys number range------D----D-----D
for i in range (30,162):
    rna_ui = obj.get('_RNA_UI')
    #####---A-------A------A-Change TO the Right key----A----A----
    varI = bpy.data.shape_keys["Key.004"].key_blocks[i].name
    #bpy.ops.wm.properties_add(data_path="object")
    obj[varI] = 0.0
   
    # property attributes.for UI ----C------Add Coustom properties ------C--C-----C
    rna_ui[varI] = {
                  "default": 0.0,
                  "min":0.0,
                  "max":1.0, 
                  "soft_min":0,
                  "soft_max":1,                 
                  "description":"Made With Gilad Script"
                  }
                  
                  #------End of C-----------
                  
                 #####----A---A--Change TO the Right key---A-----A--A--
    driver = bpy.data.shape_keys["Key.004"].key_blocks[i].driver_add("value").driver

    var = driver.variables.new()
    target = var.targets[0]
    #####-----B----B-----------Change TO the Right object--B------B----
    target.id = bpy.data.objects.get('Perfert_Man')
    target.data_path = "[" +"\""+ varI + "\"" +"]"
    driver.expression = var.name

# set it
obj[varI] = 0.0

# property attributes.for UI

# redraw Properties panel
for window in bpy.context.window_manager.windows:
    screen = window.screen

    for area in screen.areas:
        if area.type == 'PROPERTIES':
            area.tag_redraw()
            break