def METHOD_NAME(shape, name=None):
    bpy.ops.object.shape_key_add()
    key = D.shape_keys[-1].key_blocks[-1]
    if name is not None:
        key.name = name
    for i in range(len(key.data)):
        key.data[i].co = shape[i]
    return key