Remove portlets - Plone 5

Guys I want to remove the navigation portlets that is assigned default to folders via program. How to do it?

Maybe that code will help you: Remove the default portlet assignments using GenericSetup