def for_type(typ, func):
 oldfunc = _type_pprinters.get(typ, None)
 if (func is not None):
  _type_pprinters[typ] = func
 return oldfunc

def for_type ( typ , func ) : oldfunc = _type_pprinters . get ( typ , None ) if ( func is not None ) : _type_pprinters [ typ ] = func return oldfunc
add a pretty printer for a given type .