First of all, don't do this! I have a background in electrical engineering and programming. I still found this difficult. I have deep fear of the battery that I have created. I take no responsibility and this is not a guide. I don't advise doing this yourself, but thought I'd share some info I found.
Anyway with the safety out the way. My Aibo's leg broke at the hip 10 years ago. I put him away in his box and figured I'd find a solution at some point. Eventually I got pretty good at 3d printing and design. So I measured up the broken hip joint and printed a new one. Only to then realize I'd left the battery in him for at this point 7 years, and it was toast. Completely corroded.
So