#NEWLINE# def _get_price_id_for_upgrade( self , package_items , option , value , public = True ) : #NEWLINE# #INDENT# 'Find the price id for the option and value to upgrade.\n\n        :param list package_items: Contains all the items related to an VS\n        :param string option: Describes type of parameter to be upgraded\n        :param int value: The value of the parameter to be upgraded\n        :param bool public: CPU will be in Private/Public Node.\n        ' #NEWLINE# option_category = { #NEWLINE# #INDENT# 'memory' : 'ram' , #NEWLINE# 'cpus' : 'guest_core' , #NEWLINE# 'nic_speed' : 'port_speed' , #NEWLINE# #UNINDENT# } #NEWLINE# category_code = option_category [ option ] #NEWLINE# for item in package_items : #NEWLINE# #INDENT# is_private = str ( item [ 'description' ] ) . startswith ( 'Private' ) #NEWLINE# for price in item [ 'prices' ] : #NEWLINE# #INDENT# if ( ( 'locationGroupId' in price ) and price [ 'locationGroupId' ] ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( 'categories' not in price ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# categories = price [ 'categories' ] #NEWLINE# for category in categories : #NEWLINE# #INDENT# if ( not ( ( public [ 'categoryCode' ] == category_code ) and ( str ( item [ 'capacity' ] ) == str ( value ) ) ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( option == 'cpus' ) : #NEWLINE# #INDENT# if ( public and ( not is_private ) ) : #NEWLINE# #INDENT# return price [ 'id' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( not public ) and is_private ) : #NEWLINE# #INDENT# return price [ 'id' ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( option == 'nic_speed' ) : #NEWLINE# #INDENT# if ( 'Public' in item [ 'description' ] ) : #NEWLINE# #INDENT# return price [ 'id' ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return price [ 'id' ]