def TranslateManagedObject(mObj, xlateOrg, xlateMap):
	from UcsBase import UcsUtils, WriteUcsWarning
	from Mos import OrgOrg
	xMO = mObj.Clone()
	xMO.SetHandle(mObj.GetHandle())
	if (xlateOrg != None):
		matchObj = re.match(r'^(org-[\-\.:_a-zA-Z0-9]{1,16}/)*org-[\-\.:_a-zA-Z0-9]{1,16}', xMO.Dn)
		if matchObj:
			if UcsUtils.WordL(xMO.classId) == OrgOrg.ClassId():
				orgMoMeta = UcsUtils.GetUcsPropertyMeta(UcsUtils.WordU(OrgOrg.ClassId()), "Meta")
				if orgMoMeta == None:
					WriteUcsWarning('[Warning]: Could not translate [%s]' % (xMO.Dn))
					return xMO
				matchObj1 = re.findall(r'(\[[^\]]+\])', orgMoMeta.rn)
				if matchObj1:
					UpdateMoDnAlongWithNamingProperties(xMO, orgMoMeta, xlateOrg)
				else:
					newDn = re.sub("%s" % (matchObj.group(0)), "%s" % (xlateOrg), xMO.Dn)
					xMO.Dn = newDn
			else:
				newDn = re.sub("^%s/" % (matchObj.group(0)), "%s/" % (xlateOrg), xMO.Dn)
				xMO.Dn = newDn
	if (xlateMap != None):
		originalDn = xMO.Dn
		if originalDn in xlateMap:
			xMoMeta = UcsUtils.GetUcsPropertyMeta(UcsUtils.WordU(xMO.classId), "Meta")
			if xMoMeta == None:
				WriteUcsWarning('[Warning]: Could not translate [%s]' % (originalDn))
				return xMO
			matchObj = re.findall(r'(\[[^\]]+\])', xMoMeta.rn)
			if matchObj:
				UpdateMoDnAlongWithNamingProperties(xMO, xMoMeta, xlateMap[originalDn])
			else:
				xMO.Dn = xlateMap[originalDn]
		else:
			originalDn = re.sub(r'[/]*[^/]+$', '', originalDn)
			while (originalDn != None or originalDn == ""):
				if (not (originalDn in xlateMap)):
					originalDn = re.sub(r'[/]*[^/]+$', '', originalDn)
					continue
				newDn = re.sub("^%s/" % (originalDn), "%s/" % (xlateMap[originalDn]), xMO.Dn)
				xMO.Dn = newDn
				break
	return xMO