#NEWLINE# def get_security_group( self , context , id , fields = None , tenant_id = None ) : #NEWLINE# #INDENT# 'Tenant id is given to handle the case when creating a security\n        group rule on behalf of another use.\n        ' #NEWLINE# if tenant_id : #NEWLINE# #INDENT# tmp_context_tenant_id = context . tenant_id #NEWLINE# context . tenant_id = tenant_id #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# with context . session . begin ( subtransactions = True ) : #NEWLINE# #INDENT# ret = self . _make_security_group_dict ( self . _get_security_group ( context , id ) , fields ) #NEWLINE# ret [ 'security_group_rules' ] = self . get_security_group_rules ( context , { #NEWLINE# #INDENT# 'security_group_id' : [ id ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# if tenant_id : #NEWLINE# #INDENT# context . tenant_id = tmp_context_tenant_id #NEWLINE# #UNINDENT# #UNINDENT# return ret