'Returns the security groups that are associated with an instance.
If detailed is True then it also returns the full details of the
security groups associated with an instance.'

def get_instance_security_groups(self, context, instance, detailed=False):

    servers = [{'id': instance.uuid}]
    sg_bindings = self.get_instances_security_groups_bindings(context, servers, detailed)
    return sg_bindings.get(instance.uuid, [])
