def clippedObj(obj, maxElementSize=64):
 if hasattr(obj, '_asdict'):
  obj = obj._asdict()
 if isinstance(obj, dict):
  objOut = dict()
  for (key, val) in obj.iteritems():
   objOut[key] = clippedObj(val)
 elif hasattr(obj, '__iter__'):
  objOut = []
  for val in obj:
   objOut.append(clippedObj(val))
 else:
  objOut = str(obj)
  if (len(objOut) > maxElementSize):
   objOut = (objOut[0:maxElementSize] + '...')
 return objOut

def clippedObj ( obj , maxElementSize = 64 ) : if hasattr ( obj , '_asdict' ) : obj = obj . _asdict ( ) if isinstance ( obj , dict ) : objOut = dict ( ) for ( key , val ) in obj . iteritems ( ) : objOut [ key ] = clippedObj ( val ) elif hasattr ( obj , '__iter__' ) : objOut = [ ] for val in obj : objOut . append ( clippedObj ( val ) ) else : objOut = str ( obj ) if ( len ( objOut ) > maxElementSize ) : objOut = ( objOut [ 0 : maxElementSize ] + '...' ) return objOut
return a clipped version of obj suitable for printing .