Creating custom gizmo in python

Is it possible to create custom gizmos in python?

Yes, it’s possible.

Take a look at the templates that come with Blender 2.8x (TextEditor Menu > Templates > Python > Gizmo*)