label.py: removed lots of copy-paste code from Stephan Gerhard and Frank Midgley.

Additionally, fixed an error where a non-superuser could not remove its own tags
if the treenode or connector belongs to someone else.