When moving circle is inside, its called Hypotrochoid https://en.wikipedia.org/wiki/Hypotrochoid
When moving circle is outside, its called Epitrochoid https://en.wikipedia.org/wiki/Epitrochoid
The difference between two is sign for radius for moving circle.
Overall this is just ploting parametric equations in 2D in Python using complex number trick.