How to create a custom property on an object by pressing UI button? I'm writing a tool with a very simple panel with buttons.

On pressing a button a custom property with a specific name is to be assigned to the active object.

The UI should have 2 buttons Target and Clear


Pressing Target button in the UI should create a custom property. 
Pressing Clear button in the UI should delete customer property that was created by the Target button (if such customer property is present).


For example, I have Cube and Sphere (names) objects. I would select Cube, then Sphere, press Target button, and Cube will have custom property names "target" with value "Sphere". 

Selecting both of them in any manner and pressing Clear button would remove that custom property.

How do I go about making such basic add-on?

EDIT: Here is a mock-up that should explain it all :)



Link to full screen image: http://i.imgur.com/HE2HGyn.png
you want ID properties, they can be set per object

obj = bpy.data.objects['whatever']
obj['some_property_name'] = 'some_value'
obj['some_property_name_2'] = 33

&gt;&gt;&gt; obj['some_property_name_2']
... 33