def cmp_policy_info(info, remote_info):
 def is_deleted(info):
  return ((info['delete_timestamp'] > info['put_timestamp']) and (info.get('count', info.get('object_count', 0)) == 0))
 deleted = is_deleted(info)
 remote_deleted = is_deleted(remote_info)
 if any([deleted, remote_deleted]):
  if (not deleted):
   return (-1)
  elif (not remote_deleted):
   return 1
  return cmp(remote_info['status_changed_at'], info['status_changed_at'])
 def has_been_recreated(info):
  return (info['put_timestamp'] > info['delete_timestamp'] > Timestamp(0))
 remote_recreated = has_been_recreated(remote_info)
 recreated = has_been_recreated(info)
 if any([remote_recreated, recreated]):
  if (not recreated):
   return 1
  elif (not remote_recreated):
   return (-1)
  return cmp(remote_info['status_changed_at'], info['status_changed_at'])
 return cmp(info['status_changed_at'], remote_info['status_changed_at'])

def cmp_policy_info ( info , remote_info ) : def is_deleted ( info ) : return ( ( info [ 'delete_timestamp' ] > info [ 'put_timestamp' ] ) and ( info . get ( 'count' , info . get ( 'object_count' , 0 ) ) == 0 ) ) deleted = is_deleted ( info ) remote_deleted = is_deleted ( remote_info ) if any ( [ deleted , remote_deleted ] ) : if ( not deleted ) : return ( - 1 ) elif ( not remote_deleted ) : return 1 return cmp ( remote_info [ 'status_changed_at' ] , info [ 'status_changed_at' ] ) def has_been_recreated ( info ) : return ( info [ 'put_timestamp' ] > info [ 'delete_timestamp' ] > Timestamp ( 0 ) ) remote_recreated = has_been_recreated ( remote_info ) recreated = has_been_recreated ( info ) if any ( [ remote_recreated , recreated ] ) : if ( not recreated ) : return 1 elif ( not remote_recreated ) : return ( - 1 ) return cmp ( remote_info [ 'status_changed_at' ] , info [ 'status_changed_at' ] ) return cmp ( info [ 'status_changed_at' ] , remote_info [ 'status_changed_at' ] )
you have to squint to see it .