#NEWLINE# def verify_capabilities( self , capabilities ) : #NEWLINE# #INDENT# '\n        Verify that what the admin wants the server to do actually\n        can be done by this implementation.\n\n        :param capabilities: The asked for capabilities as a dictionary\n        or a ProviderConfigurationResponse instance. The later can be\n        treated as a dictionary.\n        :return: True or False\n        ' #NEWLINE# _pinfo = self . provider_features ( ) #NEWLINE# not_supported = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( key , val ) in capabilities . items ( ) : #NEWLINE# #INDENT# if isinstance ( val , six . string_types ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( val in _pinfo [ key ] ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# not_supported [ key ] = val #NEWLINE# #UNINDENT# #UNINDENT# except KeyError : #NEWLINE# #INDENT# not_supported [ key ] = '' #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( val , bool ) : #NEWLINE# #INDENT# if ( ( not _pinfo [ key ] ) and val ) : #NEWLINE# #INDENT# not_supported [ key ] = '' #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( val , list ) : #NEWLINE# #INDENT# for v in val : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( v in _pinfo [ key ] ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# not_supported [ key ] . append ( v ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# not_supported [ key ] = [ v ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except KeyError : #NEWLINE# #INDENT# not_supported [ key ] = '' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if not_supported : #NEWLINE# #INDENT# logging . error ( "Server doesn't support the following features: {}" . format ( not_supported ) ) #NEWLINE# return False #NEWLINE# #UNINDENT# return True