def diff_dict(dicta, dictb, indentation):
 retstr = ''
 for keya in dicta.keys():
  if (not (keya in dictb)):
   brackets = get_brackets(dicta[keya])
   if (type(dicta[keya]) in [str, unicode, int, float, bool, type(None)]):
    retstr += added('{4}"{0}": {2}{1}{3},'.format(keya, print_item(dicta[keya], 'added', (indentation + 1)), brackets['open'], brackets['close'], i(indentation)))
   if (type(dicta[keya]) in [list, dict]):
    retstr += added('{4}"{0}": {2}<br/>\n{1}{4}{3},'.format(keya, print_item(dicta[keya], 'added', (indentation + 1)), brackets['open'], brackets['close'], i(indentation)))
  elif (not (type(dicta[keya]) is type(dictb[keya]))):
   brackets = get_brackets(dictb[keya])
   retstr += deleted('{4}"{0}": {2}{1}{3},'.format(keya, dictb[keya], brackets['open'], brackets['close'], i(indentation)))
   brackets = get_brackets(dicta[keya])
   retstr += added('{4}"{0}": {2}{1}{3},'.format(keya, dicta[keya], brackets['open'], brackets['close'], i(indentation)))
  else:
   retstr += process_sub_dict(keya, dicta[keya], dictb[keya], indentation)
 for keyb in dictb.keys():
  if (not (keyb in dicta)):
   brackets = get_brackets(dictb[keyb])
   if (type(dictb[keyb]) in [str, unicode, int, float, bool, type(None)]):
    retstr += deleted('{4}"{0}": {2}{1}{3},'.format(keyb, print_item(dictb[keyb], 'deleted', (indentation + 1)), brackets['open'], brackets['close'], i(indentation)))
   if (type(dictb[keyb]) in [list, dict]):
    retstr += deleted('{4}"{0}": {2}<br/>\n{1}{4}{3},'.format(keyb, print_item(dictb[keyb], 'deleted', (indentation + 1)), brackets['open'], brackets['close'], i(indentation)))
 return remove_last_comma(retstr)

def diff_dict ( dicta , dictb , indentation ) : retstr = '' for keya in dicta . keys ( ) : if ( not ( keya in dictb ) ) : brackets = get_brackets ( dicta [ keya ] ) if ( type ( dicta [ keya ] ) in [ str , unicode , int , float , bool , type ( None ) ] ) : retstr += added ( '{4}"{0}": {2}{1}{3},' . format ( keya , print_item ( dicta [ keya ] , 'added' , ( indentation + 1 ) ) , brackets [ 'open' ] , brackets [ 'close' ] , i ( indentation ) ) ) if ( type ( dicta [ keya ] ) in [ list , dict ] ) : retstr += added ( '{4}"{0}": {2}<br/>\n{1}{4}{3},' . format ( keya , print_item ( dicta [ keya ] , 'added' , ( indentation + 1 ) ) , brackets [ 'open' ] , brackets [ 'close' ] , i ( indentation ) ) ) elif ( not ( type ( dicta [ keya ] ) is type ( dictb [ keya ] ) ) ) : brackets = get_brackets ( dictb [ keya ] ) retstr += deleted ( '{4}"{0}": {2}{1}{3},' . format ( keya , dictb [ keya ] , brackets [ 'open' ] , brackets [ 'close' ] , i ( indentation ) ) ) brackets = get_brackets ( dicta [ keya ] ) retstr += added ( '{4}"{0}": {2}{1}{3},' . format ( keya , dicta [ keya ] , brackets [ 'open' ] , brackets [ 'close' ] , i ( indentation ) ) ) else : retstr += process_sub_dict ( keya , dicta [ keya ] , dictb [ keya ] , indentation ) for keyb in dictb . keys ( ) : if ( not ( keyb in dicta ) ) : brackets = get_brackets ( dictb [ keyb ] ) if ( type ( dictb [ keyb ] ) in [ str , unicode , int , float , bool , type ( None ) ] ) : retstr += deleted ( '{4}"{0}": {2}{1}{3},' . format ( keyb , print_item ( dictb [ keyb ] , 'deleted' , ( indentation + 1 ) ) , brackets [ 'open' ] , brackets [ 'close' ] , i ( indentation ) ) ) if ( type ( dictb [ keyb ] ) in [ list , dict ] ) : retstr += deleted ( '{4}"{0}": {2}<br/>\n{1}{4}{3},' . format ( keyb , print_item ( dictb [ keyb ] , 'deleted' , ( indentation + 1 ) ) , brackets [ 'open' ] , brackets [ 'close' ] , i ( indentation ) ) ) return remove_last_comma ( retstr )
return a dict describing how to change orig to new .