def makepatch(original, modified):
 patch = {}
 for (key, original_value) in six.iteritems(original):
  modified_value = modified.get(key, None)
  if (modified_value is None):
   patch[key] = None
  elif (original_value != modified_value):
   if (type(original_value) == type({})):
    patch[key] = makepatch(original_value, modified_value)
   else:
    patch[key] = modified_value
  else:
   pass
 for key in modified:
  if (key not in original):
   patch[key] = modified[key]
 return patch

def makepatch ( original , modified ) : patch = { } for ( key , original_value ) in six . iteritems ( original ) : modified_value = modified . get ( key , None ) if ( modified_value is None ) : patch [ key ] = None elif ( original_value != modified_value ) : if ( type ( original_value ) == type ( { } ) ) : patch [ key ] = makepatch ( original_value , modified_value ) else : patch [ key ] = modified_value else : pass for key in modified : if ( key not in original ) : patch [ key ] = modified [ key ] return patch
create a patch object .