In [1]: first_name_dict = {'David':['Dave']}
In [2]: def get_real_first_name(name):
...: for first_name in first_name_dict:
...: if first_name == name:
...: return name
...: elif name in first_name_dict[first_name]:
...: return first_name
...: else:
...: return name
...:
In [3]: get_real_first_name('David')
Out[3]: 'David'
In [4]: get_real_first_name('Dave')
Out[4]: 'David'
I'm using Ipython. Basically you need a dictionary to do that.
The first_name_dict is your first name dictionary. For example, David can be called as "Dave" or "Davy", and Lucas can be called as "Luke", then you can write the dictionary like:
first_name_dict = {'David' : ['Dave', 'Davy'], 'Lucas' : ['Luke']}
You can improve the solution by adding "case-insensitive" matching