def Instance2Str(o, d):
 if d.has_key(o.__class__):
  return d[o.__class__](o, d)
 cl = filter((lambda x, o=o: ((type(x) is types.ClassType) and isinstance(o, x))), d.keys())
 if ((not cl) and hasattr(types, 'ObjectType')):
  cl = filter((lambda x, o=o: ((type(x) is types.TypeType) and isinstance(o, x) and (d[x] is not Instance2Str))), d.keys())
 if (not cl):
  return d[types.StringType](o, d)
 d[o.__class__] = d[cl[0]]
 return d[cl[0]](o, d)

def Instance2Str ( o , d ) : if d . has_key ( o . __class__ ) : return d [ o . __class__ ] ( o , d ) cl = filter ( ( lambda x , o = o : ( ( type ( x ) is types . ClassType ) and isinstance ( o , x ) ) ) , d . keys ( ) ) if ( ( not cl ) and hasattr ( types , 'ObjectType' ) ) : cl = filter ( ( lambda x , o = o : ( ( type ( x ) is types . TypeType ) and isinstance ( o , x ) and ( d [ x ] is not Instance2Str ) ) ) , d . keys ( ) ) if ( not cl ) : return d [ types . StringType ] ( o , d ) d [ o . __class__ ] = d [ cl [ 0 ] ] return d [ cl [ 0 ] ] ( o , d )
convert an instance to a string representation .