<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stop_all(self):
 """Stop all module instances :return: None """

        logger.info('Shutting down modules...')
        # Ask internal to quit if they can
        for instance in self.get_internal_instances():
            if hasattr(instance, 'quit') and isinstance(instance.quit, collections.Callable):
                instance.quit()

        self.clear_instances([instance for instance in self.instances if instance.is_external])