import re

a = [
	"Mr: Smith",
	"Mr: Smith; John",
	"Smith",
	"Smith; John"
]
r = r"^(?:([^:]+):\W*)?([^;]+)(?:;\W*(.+))?"

def repl(m):
	return (m.group(1) or "title" ) + "," + m.group(2) + "," + (m.group(3) or "fname")

for s in a:
	print re.sub(r, repl, s)