import bpy


from mathutils import Color


def create(obj):
    # generated by rigify.utils.write_metarig
    bpy.ops.object.mode_set(mode='EDIT')
    arm = obj.data

    for i in range(6):
        arm.rigify_colors.add()

    arm.rigify_colors[0].name = "Root"
    arm.rigify_colors[0].active = Color((0.5490196347236633, 1.0, 1.0))
    arm.rigify_colors[0].normal = Color((0.4352940022945404, 0.18431399762630463, 0.4156860113143921))
    arm.rigify_colors[0].select = Color((0.31372547149658203, 0.7843138575553894, 1.0))
    arm.rigify_colors[0].standard_colors_lock = True
    arm.rigify_colors[1].name = "IK"
    arm.rigify_colors[1].active = Color((0.5490196347236633, 1.0, 1.0))
    arm.rigify_colors[1].normal = Color((0.6039220094680786, 0.0, 0.0))
    arm.rigify_colors[1].select = Color((0.31372547149658203, 0.7843138575553894, 1.0))
    arm.rigify_colors[1].standard_colors_lock = True
    arm.rigify_colors[2].name = "Specials"
    arm.rigify_colors[2].active = Color((0.5490196347236633, 1.0, 1.0))
    arm.rigify_colors[2].normal = Color((0.9568629860877991, 0.7882350087165833, 0.04705899953842163))
    arm.rigify_colors[2].select = Color((0.31372547149658203, 0.7843138575553894, 1.0))
    arm.rigify_colors[2].standard_colors_lock = True
    arm.rigify_colors[3].name = "Tweak"
    arm.rigify_colors[3].active = Color((0.5490196347236633, 1.0, 1.0))
    arm.rigify_colors[3].normal = Color((0.03921600058674812, 0.21176500618457794, 0.5803920030593872))
    arm.rigify_colors[3].select = Color((0.31372547149658203, 0.7843138575553894, 1.0))
    arm.rigify_colors[3].standard_colors_lock = True
    arm.rigify_colors[4].name = "FK"
    arm.rigify_colors[4].active = Color((0.5490196347236633, 1.0, 1.0))
    arm.rigify_colors[4].normal = Color((0.11764699965715408, 0.5686269998550415, 0.035294000059366226))
    arm.rigify_colors[4].select = Color((0.31372547149658203, 0.7843138575553894, 1.0))
    arm.rigify_colors[4].standard_colors_lock = True
    arm.rigify_colors[5].name = "Extra"
    arm.rigify_colors[5].active = Color((0.5490196347236633, 1.0, 1.0))
    arm.rigify_colors[5].normal = Color((0.9686279892921448, 0.2509799897670746, 0.09411799907684326))
    arm.rigify_colors[5].select = Color((0.31372547149658203, 0.7843138575553894, 1.0))
    arm.rigify_colors[5].standard_colors_lock = True

    for i in range(29):
        arm.rigify_layers.add()

    arm.rigify_layers[0].name = "Face"
    arm.rigify_layers[0].row = 1
    arm.rigify_layers[0].set = False
    arm.rigify_layers[0].group = 5
    arm.rigify_layers[1].name = "Face (Tweak)"
    arm.rigify_layers[1].row = 2
    arm.rigify_layers[1].set = False
    arm.rigify_layers[1].group = 4
    arm.rigify_layers[2].name = " "
    arm.rigify_layers[2].row = 1
    arm.rigify_layers[2].set = False
    arm.rigify_layers[2].group = 0
    arm.rigify_layers[3].name = "Spine"
    arm.rigify_layers[3].row = 3
    arm.rigify_layers[3].set = False
    arm.rigify_layers[3].group = 3
    arm.rigify_layers[4].name = "Spine (Tweak)"
    arm.rigify_layers[4].row = 4
    arm.rigify_layers[4].set = False
    arm.rigify_layers[4].group = 4
    arm.rigify_layers[5].name = "Tail"
    arm.rigify_layers[5].row = 5
    arm.rigify_layers[5].set = False
    arm.rigify_layers[5].group = 6
    arm.rigify_layers[6].name = "Fins.L"
    arm.rigify_layers[6].row = 6
    arm.rigify_layers[6].set = False
    arm.rigify_layers[6].group = 5
    arm.rigify_layers[7].name = "Fins.L (Tweak)"
    arm.rigify_layers[7].row = 7
    arm.rigify_layers[7].set = False
    arm.rigify_layers[7].group = 4
    arm.rigify_layers[8].name = "Fins.R"
    arm.rigify_layers[8].row = 6
    arm.rigify_layers[8].set = False
    arm.rigify_layers[8].group = 5
    arm.rigify_layers[9].name = "Fins.R (Tweak)"
    arm.rigify_layers[9].row = 7
    arm.rigify_layers[9].set = False
    arm.rigify_layers[9].group = 4
    arm.rigify_layers[10].name = "Fins"
    arm.rigify_layers[10].row = 8
    arm.rigify_layers[10].set = False
    arm.rigify_layers[10].group = 3
    arm.rigify_layers[11].name = "Fins (Tweak)"
    arm.rigify_layers[11].row = 9
    arm.rigify_layers[11].set = False
    arm.rigify_layers[11].group = 4
    arm.rigify_layers[12].name = " "
    arm.rigify_layers[12].row = 1
    arm.rigify_layers[12].set = False
    arm.rigify_layers[12].group = 0
    arm.rigify_layers[13].name = " "
    arm.rigify_layers[13].row = 1
    arm.rigify_layers[13].set = False
    arm.rigify_layers[13].group = 6
    arm.rigify_layers[14].name = " "
    arm.rigify_layers[14].row = 1
    arm.rigify_layers[14].set = False
    arm.rigify_layers[14].group = 0
    arm.rigify_layers[15].name = " "
    arm.rigify_layers[15].row = 1
    arm.rigify_layers[15].set = False
    arm.rigify_layers[15].group = 0
    arm.rigify_layers[16].name = " "
    arm.rigify_layers[16].row = 1
    arm.rigify_layers[16].set = False
    arm.rigify_layers[16].group = 0
    arm.rigify_layers[17].name = " "
    arm.rigify_layers[17].row = 1
    arm.rigify_layers[17].set = False
    arm.rigify_layers[17].group = 0
    arm.rigify_layers[18].name = " "
    arm.rigify_layers[18].row = 1
    arm.rigify_layers[18].set = False
    arm.rigify_layers[18].group = 0
    arm.rigify_layers[19].name = " "
    arm.rigify_layers[19].row = 1
    arm.rigify_layers[19].set = False
    arm.rigify_layers[19].group = 0
    arm.rigify_layers[20].name = " "
    arm.rigify_layers[20].row = 1
    arm.rigify_layers[20].set = False
    arm.rigify_layers[20].group = 0
    arm.rigify_layers[21].name = " "
    arm.rigify_layers[21].row = 1
    arm.rigify_layers[21].set = False
    arm.rigify_layers[21].group = 0
    arm.rigify_layers[22].name = " "
    arm.rigify_layers[22].row = 1
    arm.rigify_layers[22].set = False
    arm.rigify_layers[22].group = 0
    arm.rigify_layers[23].name = " "
    arm.rigify_layers[23].row = 1
    arm.rigify_layers[23].set = False
    arm.rigify_layers[23].group = 0
    arm.rigify_layers[24].name = " "
    arm.rigify_layers[24].row = 1
    arm.rigify_layers[24].set = False
    arm.rigify_layers[24].group = 0
    arm.rigify_layers[25].name = " "
    arm.rigify_layers[25].row = 1
    arm.rigify_layers[25].set = False
    arm.rigify_layers[25].group = 0
    arm.rigify_layers[26].name = " "
    arm.rigify_layers[26].row = 1
    arm.rigify_layers[26].set = False
    arm.rigify_layers[26].group = 0
    arm.rigify_layers[27].name = " "
    arm.rigify_layers[27].row = 1
    arm.rigify_layers[27].set = False
    arm.rigify_layers[27].group = 0
    arm.rigify_layers[28].name = "Root"
    arm.rigify_layers[28].row = 14
    arm.rigify_layers[28].set = False
    arm.rigify_layers[28].group = 1

    bones = {}

    bone = arm.edit_bones.new('spine')
    bone.head[:] = -0.0000, 1.3362, 0.4776
    bone.tail[:] = -0.0000, 1.0816, 0.4540
    bone.roll = 0.0000
    bone.use_connect = False
    bones['spine'] = bone.name
    bone = arm.edit_bones.new('spine.001')
    bone.head[:] = -0.0000, 1.0816, 0.4540
    bone.tail[:] = -0.0000, 0.7152, 0.4305
    bone.roll = -0.0000
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['spine']]
    bones['spine.001'] = bone.name
    bone = arm.edit_bones.new('back_fin.T.Bk')
    bone.head[:] = 0.0000, 1.2501, 0.5345
    bone.tail[:] = 0.0000, 1.5211, 0.7594
    bone.roll = 0.0000
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['spine']]
    bones['back_fin.T.Bk'] = bone.name
    bone = arm.edit_bones.new('back_fin.B.Bk')
    bone.head[:] = 0.0000, 1.2305, 0.4158
    bone.tail[:] = 0.0000, 1.3289, 0.2452
    bone.roll = 0.0000
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['spine']]
    bones['back_fin.B.Bk'] = bone.name
    bone = arm.edit_bones.new('spine.002')
    bone.head[:] = -0.0000, 0.7152, 0.4305
    bone.tail[:] = -0.0000, 0.3182, 0.4031
    bone.roll = -0.0000
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['spine.001']]
    bones['spine.002'] = bone.name
    bone = arm.edit_bones.new('mid_fin.Top')
    bone.head[:] = 0.0000, 0.7296, 0.5396
    bone.tail[:] = 0.0000, 0.7709, 0.6351
    bone.roll = 0.0000
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['spine.001']]
    bones['mid_fin.Top'] = bone.name
    bone = arm.edit_bones.new('mid_fin.Bot')
    bone.head[:] = 0.0000, 0.7296, 0.3505
    bone.tail[:] = 0.0000, 0.8233, 0.2684
    bone.roll = 1.5708
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['spine.001']]
    bones['mid_fin.Bot'] = bone.name
    bone = arm.edit_bones.new('back_fin.T.001.Bk')
    bone.head[:] = 0.0000, 1.5211, 0.7594
    bone.tail[:] = 0.0000, 1.7667, 0.9633
    bone.roll = 0.0000
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['back_fin.T.Bk']]
    bones['back_fin.T.001.Bk'] = bone.name
    bone = arm.edit_bones.new('back_fin.B.001.Bk')
    bone.head[:] = 0.0000, 1.3289, 0.2452
    bone.tail[:] = 0.0000, 1.3818, 0.1513
    bone.roll = 0.0000
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['back_fin.B.Bk']]
    bones['back_fin.B.001.Bk'] = bone.name
    bone = arm.edit_bones.new('spine.003')
    bone.head[:] = -0.0000, 0.3182, 0.4031
    bone.tail[:] = -0.0000, 0.0152, 0.3904
    bone.roll = 0.0001
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['spine.002']]
    bones['spine.003'] = bone.name
    bone = arm.edit_bones.new('back_fin.T.002.Bk')
    bone.head[:] = 0.0000, 1.7667, 0.9633
    bone.tail[:] = 0.0000, 1.9489, 1.1145
    bone.roll = 0.0000
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['back_fin.T.001.Bk']]
    bones['back_fin.T.002.Bk'] = bone.name
    bone = arm.edit_bones.new('spine.008')
    bone.head[:] = -0.0000, 0.0152, 0.3904
    bone.tail[:] = 0.0000, -0.3259, 0.3967
    bone.roll = 0.0001
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['spine.003']]
    bones['spine.008'] = bone.name
    bone = arm.edit_bones.new('spine.004')
    bone.head[:] = 0.0000, -0.3259, 0.3967
    bone.tail[:] = 0.0000, -0.5947, 0.4044
    bone.roll = -0.0001
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['spine.008']]
    bones['spine.004'] = bone.name
    bone = arm.edit_bones.new('chest_fin.Bot.L')
    bone.head[:] = 0.0889, 0.2605, 0.2866
    bone.tail[:] = 0.1731, 0.3299, 0.1901
    bone.roll = -2.3171
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['spine.008']]
    bones['chest_fin.Bot.L'] = bone.name
    bone = arm.edit_bones.new('chest_fin.Bot.R')
    bone.head[:] = -0.0889, 0.2605, 0.2866
    bone.tail[:] = -0.1731, 0.3299, 0.1901
    bone.roll = 2.3171
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['spine.008']]
    bones['chest_fin.Bot.R'] = bone.name
    bone = arm.edit_bones.new('spine.005')
    bone.head[:] = 0.0000, -0.5947, 0.4044
    bone.tail[:] = 0.0000, -1.2084, 0.4328
    bone.roll = 0.0000
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['spine.004']]
    bones['spine.005'] = bone.name
    bone = arm.edit_bones.new('top_fin')
    bone.head[:] = 0.0000, -0.2777, 0.5550
    bone.tail[:] = 0.0000, -0.1962, 0.7053
    bone.roll = 0.0000
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['spine.004']]
    bones['top_fin'] = bone.name
    bone = arm.edit_bones.new('spine.006')
    bone.head[:] = 0.0000, -1.2084, 0.4328
    bone.tail[:] = 0.0000, -1.5634, 0.4275
    bone.roll = -0.0000
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['spine.005']]
    bones['spine.006'] = bone.name
    bone = arm.edit_bones.new('shoulder.L')
    bone.head[:] = 0.0729, -0.9648, 0.3756
    bone.tail[:] = 0.2649, -0.9648, 0.3157
    bone.roll = 3.4558
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['spine.005']]
    bones['shoulder.L'] = bone.name
    bone = arm.edit_bones.new('shoulder.R')
    bone.head[:] = -0.0729, -0.9648, 0.3756
    bone.tail[:] = -0.2649, -0.9648, 0.3157
    bone.roll = -3.4558
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['spine.005']]
    bones['shoulder.R'] = bone.name
    bone = arm.edit_bones.new('top_fin.001')
    bone.head[:] = 0.0000, -0.1962, 0.7053
    bone.tail[:] = 0.0000, -0.1362, 0.8158
    bone.roll = 0.0000
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['top_fin']]
    bones['top_fin.001'] = bone.name
    bone = arm.edit_bones.new('spine.007')
    bone.head[:] = 0.0000, -1.5634, 0.4275
    bone.tail[:] = 0.0000, -2.0661, 0.4364
    bone.roll = 0.0000
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['spine.006']]
    bones['spine.007'] = bone.name
    bone = arm.edit_bones.new('side_fin.L')
    bone.head[:] = 0.2140, -0.9624, 0.2213
    bone.tail[:] = 0.5220, -0.9078, -0.1343
    bone.roll = -2.3170
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['shoulder.L']]
    bones['side_fin.L'] = bone.name
    bone = arm.edit_bones.new('side_fin.R')
    bone.head[:] = -0.2140, -0.9624, 0.2213
    bone.tail[:] = -0.5220, -0.9078, -0.1343
    bone.roll = 2.3170
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['shoulder.R']]
    bones['side_fin.R'] = bone.name
    bone = arm.edit_bones.new('eye.L')
    bone.head[:] = 0.1405, -1.6860, 0.4161
    bone.tail[:] = 0.3684, -1.6810, 0.4156
    bone.roll = 3.1352
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['spine.007']]
    bones['eye.L'] = bone.name
    bone = arm.edit_bones.new('eye.R')
    bone.head[:] = -0.1405, -1.6860, 0.4161
    bone.tail[:] = -0.3684, -1.6810, 0.4156
    bone.roll = -3.1352
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['spine.007']]
    bones['eye.R'] = bone.name
    bone = arm.edit_bones.new('jaw.master')
    bone.head[:] = -0.0000, -1.5791, 0.2788
    bone.tail[:] = 0.0000, -1.9421, 0.3386
    bone.roll = 0.0000
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['spine.007']]
    bones['jaw.master'] = bone.name
    bone = arm.edit_bones.new('side_fin.L.001')
    bone.head[:] = 0.5220, -0.9078, -0.1343
    bone.tail[:] = 0.7928, -0.7598, -0.4802
    bone.roll = -2.2826
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['side_fin.L']]
    bones['side_fin.L.001'] = bone.name
    bone = arm.edit_bones.new('side_fin.R.001')
    bone.head[:] = -0.5220, -0.9078, -0.1343
    bone.tail[:] = -0.7928, -0.7598, -0.4802
    bone.roll = 2.2826
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['side_fin.R']]
    bones['side_fin.R.001'] = bone.name
    bone = arm.edit_bones.new('jaw')
    bone.head[:] = -0.0000, -1.5791, 0.2788
    bone.tail[:] = 0.0000, -1.7326, 0.3041
    bone.roll = 0.0000
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['jaw.master']]
    bones['jaw'] = bone.name
    bone = arm.edit_bones.new('jaw.002.L')
    bone.head[:] = 0.0891, -1.5791, 0.2894
    bone.tail[:] = 0.1110, -1.7198, 0.3129
    bone.roll = 1.4894
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['jaw.master']]
    bones['jaw.002.L'] = bone.name
    bone = arm.edit_bones.new('jaw.002.R')
    bone.head[:] = -0.0891, -1.5791, 0.2894
    bone.tail[:] = -0.1110, -1.7198, 0.3129
    bone.roll = -1.4894
    bone.use_connect = False
    bone.parent = arm.edit_bones[bones['jaw.master']]
    bones['jaw.002.R'] = bone.name
    bone = arm.edit_bones.new('jaw.001')
    bone.head[:] = 0.0000, -1.7326, 0.3041
    bone.tail[:] = 0.0000, -1.8860, 0.3294
    bone.roll = 0.0000
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['jaw']]
    bones['jaw.001'] = bone.name
    bone = arm.edit_bones.new('jaw.003.L')
    bone.head[:] = 0.1110, -1.7198, 0.3129
    bone.tail[:] = 0.1260, -1.8159, 0.3326
    bone.roll = 1.2807
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['jaw.002.L']]
    bones['jaw.003.L'] = bone.name
    bone = arm.edit_bones.new('jaw.003.R')
    bone.head[:] = -0.1110, -1.7198, 0.3129
    bone.tail[:] = -0.1260, -1.8159, 0.3326
    bone.roll = -1.2807
    bone.use_connect = True
    bone.parent = arm.edit_bones[bones['jaw.002.R']]
    bones['jaw.003.R'] = bone.name

    bpy.ops.object.mode_set(mode='OBJECT')
    pbone = obj.pose.bones[bones['spine']]
    pbone.rigify_type = 'spines.super_spine'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    try:
        pbone.rigify_parameters.neck_pos = 8
    except AttributeError:
        pass
    try:
        pbone.rigify_parameters.tweak_layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    except AttributeError:
        pass
    try:
        pbone.rigify_parameters.tail_pos = 3
    except AttributeError:
        pass
    try:
        pbone.rigify_parameters.pivot_pos = 5
    except AttributeError:
        pass
    try:
        pbone.rigify_parameters.use_tail = True
    except AttributeError:
        pass
    try:
        pbone.rigify_parameters.copy_rotation_axes = [True, False, True]
    except AttributeError:
        pass
    pbone = obj.pose.bones[bones['spine.001']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['back_fin.T.Bk']]
    pbone.rigify_type = 'limbs.super_finger'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    try:
        pbone.rigify_parameters.tweak_layers = [False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    except AttributeError:
        pass
    try:
        pbone.rigify_parameters.primary_rotation_axis = "Z"
    except AttributeError:
        pass
    pbone = obj.pose.bones[bones['back_fin.B.Bk']]
    pbone.rigify_type = 'limbs.super_finger'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    try:
        pbone.rigify_parameters.tweak_layers = [False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    except AttributeError:
        pass
    try:
        pbone.rigify_parameters.primary_rotation_axis = "Z"
    except AttributeError:
        pass
    pbone = obj.pose.bones[bones['spine.002']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['mid_fin.Top']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['mid_fin.Bot']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['back_fin.T.001.Bk']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['back_fin.B.001.Bk']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['spine.003']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['back_fin.T.002.Bk']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['spine.008']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['spine.004']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['chest_fin.Bot.L']]
    pbone.rigify_type = 'basic.super_copy'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    try:
        pbone.rigify_parameters.tweak_layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    except AttributeError:
        pass
    pbone = obj.pose.bones[bones['chest_fin.Bot.R']]
    pbone.rigify_type = 'basic.super_copy'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    try:
        pbone.rigify_parameters.tweak_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    except AttributeError:
        pass
    pbone = obj.pose.bones[bones['spine.005']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['top_fin']]
    pbone.rigify_type = 'limbs.simple_tentacle'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    try:
        pbone.rigify_parameters.tweak_layers = [False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    except AttributeError:
        pass
    pbone = obj.pose.bones[bones['spine.006']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['shoulder.L']]
    pbone.rigify_type = 'basic.super_copy'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    try:
        pbone.rigify_parameters.make_widget = False
    except AttributeError:
        pass
    pbone = obj.pose.bones[bones['shoulder.R']]
    pbone.rigify_type = 'basic.super_copy'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    try:
        pbone.rigify_parameters.make_widget = False
    except AttributeError:
        pass
    pbone = obj.pose.bones[bones['top_fin.001']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['spine.007']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['side_fin.L']]
    pbone.rigify_type = 'limbs.simple_tentacle'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    try:
        pbone.rigify_parameters.tweak_layers = [False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    except AttributeError:
        pass
    try:
        pbone.rigify_parameters.copy_rotation_axes = [True, False, False]
    except AttributeError:
        pass
    pbone = obj.pose.bones[bones['side_fin.R']]
    pbone.rigify_type = 'limbs.simple_tentacle'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    try:
        pbone.rigify_parameters.tweak_layers = [False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    except AttributeError:
        pass
    try:
        pbone.rigify_parameters.copy_rotation_axes = [True, False, False]
    except AttributeError:
        pass
    pbone = obj.pose.bones[bones['eye.L']]
    pbone.rigify_type = 'basic.super_copy'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['eye.R']]
    pbone.rigify_type = 'basic.super_copy'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['jaw.master']]
    pbone.rigify_type = 'basic.super_copy'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    try:
        pbone.rigify_parameters.make_widget = False
    except AttributeError:
        pass
    try:
        pbone.rigify_parameters.make_deform = False
    except AttributeError:
        pass
    pbone = obj.pose.bones[bones['side_fin.L.001']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['side_fin.R.001']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['jaw']]
    pbone.rigify_type = 'limbs.simple_tentacle'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['jaw.002.L']]
    pbone.rigify_type = 'limbs.simple_tentacle'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['jaw.002.R']]
    pbone.rigify_type = 'limbs.simple_tentacle'
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['jaw.001']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['jaw.003.L']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
    pbone = obj.pose.bones[bones['jaw.003.R']]
    pbone.rigify_type = ''
    pbone.lock_location = (False, False, False)
    pbone.lock_rotation = (False, False, False)
    pbone.lock_rotation_w = False
    pbone.lock_scale = (False, False, False)
    pbone.rotation_mode = 'QUATERNION'
    pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]

    bpy.ops.object.mode_set(mode='EDIT')
    for bone in arm.edit_bones:
        bone.select = False
        bone.select_head = False
        bone.select_tail = False
    for b in bones:
        bone = arm.edit_bones[bones[b]]
        bone.select = True
        bone.select_head = True
        bone.select_tail = True
        arm.edit_bones.active = bone

    arm.layers = [(x in [0, 3, 5, 6, 8, 10]) for x in range(32)]

if __name__ == "__main__":
    create(bpy.context.active_object)