Method to return string representation of a managed object.

def _write_mo(mo):
	""" Method to return string representation of a managed object. """
	# from UcsBase import UcsUtils
	classNotFound = False
	if (UcsUtils.FindClassIdInMoMetaIgnoreCase(mo.classId) == None):
		classNotFound = True

	tabsize = 8
	outstr = "\n"
	if classNotFound:
		outstr += "Managed Object\t\t\t:\t" + str(UcsUtils.WordU(mo.classId)) + "\n"
	else:
		outstr += "Managed Object\t\t\t:\t" + str(mo.propMoMeta.name) + "\n"
	outstr += "-" * len("Managed Object") + "\n"
	if (not classNotFound):
		for prop in UcsUtils.GetUcsPropertyMetaAttributeList(mo.propMoMeta.name):
			propMeta = UcsUtils.GetUcsPropertyMeta(mo.propMoMeta.name, prop)
			if (propMeta.access == UcsPropertyMeta.Internal):
				continue
			val = mo.getattr(prop)
			# if val != None and val != "":
			outstr += str(prop).ljust(tabsize * 4) + ':' + str(val) + "\n"
	else:
		for prop in mo.__dict__:
			if (prop in ['classId', 'XtraProperty', 'handle', 'propMoMeta', 'dirtyMask', 'child']):
				continue
			val = mo.__dict__[prop]
			outstr += str(UcsUtils.WordU(prop)).ljust(tabsize * 4) + ':' + str(val) + "\n"
	if mo.__dict__.has_key('XtraProperty'):
		for xtraProp in mo.__dict__['XtraProperty']:
			outstr += '[X]' + str(UcsUtils.WordU(xtraProp)).ljust(tabsize * 4) + ':' + str(
				mo.__dict__['XtraProperty'][xtraProp]) + "\n"

	outstr += str("Ucs").ljust(tabsize * 4) + ':' + str(mo.handle._ucs) + "\n"

	outstr += "\n"
	return outstr