def _safe_rep(obj, short=False):
 try:
  result = repr(obj)
 except Exception:
  result = object.__repr__(obj)
 if ((not short) or (len(result) < 80)):
  return result
 return (result[:80] + ' [truncated]...')

def _safe_rep ( obj , short = False ) : try : result = repr ( obj ) except Exception : result = object . __repr__ ( obj ) if ( ( not short ) or ( len ( result ) < 80 ) ) : return result return ( result [ : 80 ] + ' [truncated]...' )
helper for assert_* ports .