Maya Python : How do I select object that I recently created?

I am creating a distance node and need to point constrain the two locators to some joints but the problem is, how would I go about finding them using Python? (They are not selected after the command)

selected = mc.ls(sl=True)

t_one = mc.xform(IKP[0], q=True, t=True, ws=True)
t_two = mc.xform(IKP[3], q=True, t=True, ws=True)

mc.distanceDimension(sp = t_one , ep= t_two,)

Figured it out:

selected = mc.ls(sl=True)


lerp = mc.listRelatives(selected, s=True)

derp = mc.listConnections(lerp)

http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/CommandsPython/distanceDimension.html

Return value

string - the shape name of the DAG node created.

capture the new node into variable.