1def get_first_last_name(s):
2 INVALID_NAME_PARTS = ["mr", "ms", "mrs",
3 "dr", "jr", "sir"]
4 parts = s.lower().replace(".","").strip().split()
5 parts = [p for p in parts if p not in INVALID_NAME_PARTS]
6 if len(parts) == 0:
7 raise ValueError("Name %s is formatted wrong" %s)
8 first,last = parts[0], parts[-1]
9 first = first[0].upper() + first[1:]
10 last = last[0].upper() + last[1:]
11
12 return first, last