import bpy
context = bpy.context
obj = context.object
#you still need to fix it up until the point you would normally rename the bones
#credit to Hallow for original script https://gamebanana.com/tools/6414
namelist = [

#("BoneNameYouWantRenamed", "BoneNameToRenameBoneTo")
#Example:
#("chest_a", "Spine1"),
#Templete
("Hips", "koshi"),
("Spine", "hara1"),
("Chest", "mune"),
("Neck", "kubi"),
("Head", "atama"),
("Upperbodyb", "koshi_spo"),
("Hood", "hood"),
("Hood1", "hood1"),
("Hood2", "hood2"),

("Hair_left_1", "L_kami_a1"),
("Hair_left_2", "L_kami_b1"),
("Hair_left_3", "L_kami_c1"),
("Hair_left_4", "L_kami_d1"),
("Hair_right_1", "R_kami_a1"),
("Hair_right_2", "R_kami_b1"),
("Hair_right_3", "R_kami_c1"),
("Hair_right_4", "R_kami_d1"),
("Hair_upper_1", "C_kami_a1"),
("Hair_upper_2", "C_kami_b1"),
("Hair_upper_3", "C_kami_c1"),
("Hair_upper_4", "C_kami_d1"),
("Hair_upper_5", "C_kami_e1"),
("Hair_upper_6", "C_kami_f1"),
("Hair_upper_7", "C_kami_g1"),
("Hair_upper_8", "C_kami_h1"),
("Hair_upper_9", "C_kami_i1"),

("Right shoulder", "R_kata"),
("Left shoulder", "L_kata"),
("Right arm", "R_ude1"),
("Right elbow", "R_ude2"),
("Right wrist", "R_te"),
("Left arm", "L_ude1"),
("Left elbow", "L_ude2"),
("Left wrist", "L_te"),

("Right leg", "R_momo"),
("Right knee", "R_sune"),
("Right ankle", "R_ashi1"),
("Right toe", "R_ashi2"),
("Leg_right_butt", "R_shiri_spo"),

("Left leg", "L_momo"),
("Left knee", "L_sune"),
("Left ankle", "L_ashi1"),
("Left toe", "L_ashi2"),
("Leg_left_butt", "L_shiri_spo"),

("Eye_L", "L_eye"),
("Eye_R", "R_eye"),
("Chin", "C_chin"),
("Tongroot", "C_tongroot"),
("Head_tongue_middle_1", "C_tongroot"),
("Head_tongue_middle_2", "C_tongtip"),
("Tongtip", "C_tongtip"),
("Jaw", "C_jaw"),
("Nose", "C_nose"),

("Head_cheek_right_1", "R_cheek_a"),
("Head_cheek_right_2", "R_cheek_b"),
("Head_cheek_right_3", "R_puff"),
("Head_cheek_left_1", "L_cheek_a"),
("Head_cheek_left_2", "L_cheek_b"),
("Head_cheek_left_3", "L_puff"),

("Head_eyebrow_left_1", "L_brow_a"),
("Head_eyebrow_left_2", "L_brow_b"),
("Head_eyebrow_left_3", "L_brow_c"),
("Head_eyebrow_left_4", "L_brow_d"),
("Head_eyebrow_right_1", "R_brow_a"),
("Head_eyebrow_right_2", "R_brow_b"),
("Head_eyebrow_right_3", "R_brow_c"),
("Head_eyebrow_right_4", "R_brow_d"),

("Head_eyelid_left_corner_inner", "LD_eyelid_a"),
("Head_eyelid_left_lower_1", "LD_eyelid_b"),
("Head_eyelid_left_lower_2", "LD_eyelid_c"),
("Head_eyelid_left_corner_outer", "LU_eyelid_a"),
("Head_eyelid_left_upper_1", "LU_eyelid_b"),
("Head_eyelid_left_upper_2", "LU_eyelid_c"),
("Head_eyelid_right_corner_inner", "RD_eyelid_a"),
("Head_eyelid_right_lower_1", "RD_eyelid_b"),
("Head_eyelid_right_lower_2", "RD_eyelid_c"),
("Head_eyelid_right_corner_outer", "RU_eyelid_a"),
("Head_eyelid_right_upper_1", "RU_eyelid_b"),
("Head_eyelid_right_upper_2", "RU_eyelid_c"),

("Head_lip_upper_middle", "CU_lip"),
("Head_lip_upper_right", "RU_lip"),
("Head_lip_upper_left", "LU_lip"),
("Head_lip_lower_middle", "CD_lip"),
("Head_lip_lower_right", "RD_lip"),
("Head_lip_lower_left", "LD_lip"),
("Head_teeth_lower", "CD_Teeth"),
("Head_teeth_upper", "CU_Teeth"),
("Head_mouth_corner_left", "LU_cor"),
("Head_mouth_corner_right", "RU_cor"),

#righthand
("Thumb0_R", "R_yubiA1"),
("IndexFinger1_R", "R_yubiB1"),
("MiddleFinger1_R", "R_yubiC1"),
("RingFinger1_R", "R_yubiD1"),
("LittleFinger1_R", "R_yubiE1"),
("Thumb1_R", "R_yubiA2"),
("IndexFinger2_R", "R_yubiB2"),
("MiddleFinger2_R", "R_yubiC2"),
("RingFinger2_R", "R_yubiD2"),
("LittleFinger2_R", "R_yubiE2"),
("Thumb2_R", "R_yubiA3"),
("IndexFinger3_R", "R_yubiB3"),
("MiddleFinger3_R", "R_yubiC3"),
("RingFinger3_R", "R_yubiD3"),
("LittleFinger3_R", "R_yubiE3"),

("Finger_Thumb_R", "R_yubiA1"),
("Finger_Index_R", "R_yubiB1"),
("Finger_Middle_R", "R_yubiC1"),
("Finger_Ring_R", "R_yubiD1"),
("Finger_Pinky_R", "R_yubiE1"),

("Finger_Thumb_R_001", "R_yubiA2"),
("Finger_Index_R_001", "R_yubiB2"),
("Finger_Middle_R_001", "R_yubiC2"),
("Finger_Ring_R_001", "R_yubiD2"),
("Finger_Pinky_R_001", "R_yubiE2"),

("Finger_Thumb_R_002", "R_yubiA3"),
("Finger_Index_R_002", "R_yubiB3"),
("Finger_Middle_R_002", "R_yubiC3"),
("Finger_Ring_R_002", "R_yubiD3"),
("Finger_Pinky_R_002", "R_yubiE3"),

#lefthand
("Thumb0_L", "L_yubiA1"),
("IndexFinger1_L", "L_yubiB1"),
("MiddleFinger1_L", "L_yubiC1"),
("RingFinger1_L", "L_yubiD1"),
("LittleFinger1_L", "L_yubiE1"),
("Thumb1_L", "L_yubiA2"),
("IndexFinger2_L", "L_yubiB2"),
("MiddleFinger2_L", "L_yubiC2"),
("RingFinger2_L", "L_yubiD2"),
("LittleFinger2_L", "L_yubiE2"),
("Thumb2_L", "L_yubiA3"),
("IndexFinger3_L", "L_yubiB3"),
("MiddleFinger3_L", "L_yubiC3"),
("RingFinger3_L", "L_yubiD3"),
("LittleFinger3_L", "L_yubiE3"),

("Finger_Thumb_L", "L_yubiA1"),
("Finger_Index_L", "L_yubiB1"),
("Finger_Middle_L", "L_yubiC1"),
("Finger_Ring_L", "L_yubiD1"),
("Finger_Pinky_L", "L_yubiE1"),

("Finger_Thumb_L_001", "L_yubiA2"),
("Finger_Index_L_001", "L_yubiB2"),
("Finger_Middle_L_001", "L_yubiC2"),
("Finger_Ring_L_001", "L_yubiD2"),
("Finger_Pinky_L_001", "L_yubiE2"),

("Finger_Thumb_L_002", "L_yubiA3"),
("Finger_Index_L_002", "L_yubiB3"),
("Finger_Middle_L_002", "L_yubiC3"),
("Finger_Ring_L_002", "L_yubiD3"),
("Finger_Pinky_L_002", "L_yubiE3"),

("SkirtParent", "skt_all"),
("FrontSK00_1", "F_skt1"),
("BackSK14_1", "B_skt1"),
("FrontSK00_8", "F_skt4"),
("BackSK14_8", "B_skt4"),
("SK07_1_L", "L_sktC1"),
("SK07_8_L", "L_F_sktC1"),
("SK07_1_R", "R_sktC1"),
("SK07_8_R", "R_F_sktC1"),


]

for name, newname in namelist:
    # get the pose bone with name
    pb = obj.pose.bones.get(name)
    # continue if no bone of that name
    if pb is None:
        continue
    # rename
    pb.name = newname
