#NEWLINE# def _match_in_cache( cache_tree , list_of_names ) : #NEWLINE# #INDENT# '\n    :type cache_tree: defaultdict\n    :description cache_tree: a defaultdict initialized with the tree() function.  Contains names\n                             of entries in the kairosdb, separated by "." per the graphite convention.\n\n    :type list_of_names: list\n    :description list_of_names: list of strings, in order, that will be sought after in the cache tree.\n\n    :rtype: list\n    :return: A list of matches, possibly empty.\n\n    Given a cache_tree, and a prefix, returns all of the values associated with that prefix,\n    that is, the keys that reside under the prefix.\n    ' #NEWLINE# head_item = list_of_names [ 0 ] #NEWLINE# head_item_matches = [ m for m in cache_tree . keys ( ) if fnmatch . fnmatch ( m , tail_list ) ] #NEWLINE# if ( head_item not in cache_tree . keys ( ) ) : #NEWLINE# #INDENT# return [ ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( list_of_names ) == 1 ) : #NEWLINE# #INDENT# return cache_tree [ head_item ] . keys ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# tail_list = list_of_names [ 1 : ] #NEWLINE# return _match_in_cache ( cache_tree [ head_item ] , tail_list )