def _field_diff(field, old, new):
 oldval = old.get(field)
 newval = new.get(field)
 if (isinstance(oldval, float) and isinstance(newval, float) and (abs((oldval - newval)) < FLOAT_EPSILON)):
  return None
 elif (oldval == newval):
  return None
 oldstr = old.formatted().get(field, u'')
 newstr = new.formatted().get(field, u'')
 if isinstance(oldval, basestring):
  (oldstr, newstr) = colordiff(oldval, newstr)
 else:
  (oldstr, newstr) = (colorize('red', oldstr), colorize('red', newstr))
 return u'{0} -> {1}'.format(oldstr, newstr)

def _field_diff ( field , old , new ) : oldval = old . get ( field ) newval = new . get ( field ) if ( isinstance ( oldval , float ) and isinstance ( newval , float ) and ( abs ( ( oldval - newval ) ) < FLOAT_EPSILON ) ) : return None elif ( oldval == newval ) : return None oldstr = old . formatted ( ) . get ( field , u'' ) newstr = new . formatted ( ) . get ( field , u'' ) if isinstance ( oldval , basestring ) : ( oldstr , newstr ) = colordiff ( oldval , newstr ) else : ( oldstr , newstr ) = ( colorize ( 'red' , oldstr ) , colorize ( 'red' , newstr ) ) return u'{0} -> {1}' . format ( oldstr , newstr )
given two model objects .