Recursively find checked item.

def setThirdStateChecked(src, ids=[], dpth = 0, key = ''):
    """ Recursively find checked item."""
    #tabs = lambda n: ' ' * n * 4 # or 2 or 8 or...
    #brace = lambda s, n: '%s%s%s' % ('['*n, s, ']'*n)
    #print('third state nodes: ', third_state_nodes)
    if isinstance(src, dict):
        #print "DICT: ", src
        if 'children' in src and type(src['children']) is list and len(src['children']) > 0:
        	children = src['children']
        	number_of_possible_checked = len(children)
        	number_of_checked = 0
        	for c in children:
        		if 'checked' in c and c['checked']:
        			number_of_checked += 1
        	if number_of_possible_checked == number_of_checked:
        		src['checked'] = True
        	elif number_of_checked > 0:
        		#print('>>>>> APPENDING: ', src['id'])
        		lineage = src['id'].split('.')
        		#fun(src, lineage)
        		src['cls'] = 'x-tree-checkbox-checked-disabled'

        for key, value in src.iteritems():
            setThirdStateChecked(value, ids, dpth + 1, key)
    elif isinstance(src, list):
        for litem in src:
            if isinstance(litem, types.DictType):
	            #print litem["id"]
	            #print third_state_nodes
	            #if "id" in litem and litem["id"] in third_state_nodes:
	            #	litem["cls"] = 'x-tree-checkbox-checked-disabled'
	            pass
            setThirdStateChecked(litem, ids, dpth + 2)