def karma(nick, rest):
	"Return or change the karma value for some(one|thing)"
	karmee = rest.strip('++').strip('--').strip('~~')
	if '++' in rest:
		Karma.store.change(karmee, 1)
	elif '--' in rest:
		Karma.store.change(karmee, -1)
	elif '~~' in rest:
		change = random.choice([-1, 0, 1])
		Karma.store.change(karmee, change)
		if change == 1:
			return "%s karma++" % karmee
		elif change == 0:
			return "%s karma shall remain the same" % karmee
		elif change == -1:
			return "%s karma--" % karmee
	elif '==' in rest:
		t1, t2 = rest.split('==')
		try:
			Karma.store.link(t1, t2)
		except SameName:
			Karma.store.change(nick, -1)
			return "Don't try to link a name to itself!"
		except AlreadyLinked:
			return "Those names were previously linked."
		score = Karma.store.lookup(t1)
		return "%s and %s are now linked and have a score of %s" % (t1, t2, score)
	else:
		karmee = rest or nick
		score = Karma.store.lookup(karmee)
		return "%s has %s karmas" % (karmee, score)