The mixing would look like the following…

```
class DeleteScalingGroupMixin(object):
    def wait_for_instances_to_shutdown(self, scaling_group):
        if scaling_group.instances:
            ec2_conn = self.get_connection()
            instance_ids = [i.instance_id for i in scaling_group.instances]
            is_all_shutdown = False
            count = 0
            while is_all_shutdown is False and count < 30:
                instances = ec2_conn.get_only_instances(instance_ids)
                if instances:
                    is_all_shutdown = True
                    for instance in instances:
                        if self.cloud_type == 'aws':
                            if not str(instance._state).startswith('terminated'):
                                is_all_shutdown = False
                        else:
                            if not str(instance._state).startswith('terminated') and not str(instance._state).startswith('shutting-down'):
                                is_all_shutdown = False
                    time.sleep(3)
                count += 1
        return
```

And the Mixin would be added to the list of inherited classes for the view class, e.g. as follows…

`class ScalingGroupView(BaseScalingGroupView, DeleteScalingGroupMixin):`