Hey Jorge,
You can use this, very simple.
import maya.cmds as mc
result = mc.ls(“pSphere1”)
if len(result) > 1:
print “Non unique.”
Use maya.cmds.ls to query the desired name, in this case “pSphere1” and if anything more than 1 result is returned, you know its non unique.
Hope that helps!