def typename(obj):
 if hasattr(obj, '__class__'):
  return getattr(obj, '__class__').__name__
 else:
  return type(obj).__name__

def typename ( obj ) : if hasattr ( obj , '__class__' ) : return getattr ( obj , '__class__' ) . __name__ else : return type ( obj ) . __name__
robust class-name utility-function .