The parameter represents a “person to friends” dictionary. This function must return a “last name to first names” dictionarybuilt from the data in the given dictionary.

The parameter represents a “person to friends” dictionary. This function must return a “last name to first names” dictionarybuilt from the data in the given dictionary. The keys in the returned dictionary should be the last names of people in the givendictionary. (Remember: every person has exactly one last name.) The values are lists of the first names (sorted in alphabeticalorder) of people with a given last name.get_last_to_first:(Dict[str, List [str]]) -> Dict[str, List[str] ]The returned dictionary should contain every person whose name appears in the given dictionary: the person’s last name asone of the dictionary keys, and the person’s first name as an element in one of the dictionary values. Names in the list shouldbe unique: no one should be listed more than once. Use the list method sort to put the lists of first names into alphabeticalorder.The parameter represents a dictionary, in which either the values are all lists or none of the values are lists. This function mustreturn a new dictionary that is the given dictionary inverted: each key is a value or an item from a values list from the givendictionary, and each value is a list of the corresponding keys from the given dictionary. The items in the new dictionary’svalues lists are sorted.For example, given the following argument (based on profiles. txt) :{ ‘Claire Dunphy’ : [‘Parent Teacher Association’ ],”Manny Delgado’: [‘Chess Club’ ],”Mitchell Pritchett’: [‘ Law Association’ ],”Alex Dunphy’ : [‘Chess Club’, ‘Orchestra’ ],invert_and_sort:Cameron Tucker’ : [‘Clown School’ , ‘Wizard of Oz Fan Club’ ],(Dict [object, object]) -> Dict[object, list]Phil Dunphy’: [‘Real Estate Association’ ],’Gloria Pritchett’: [‘Parent Teacher Association’ ]}the function should return:{ ‘Parent Teacher Association’: [‘Claire Dunphy’, ‘Gloria Pritchett’ ],’Chess Club’ : [‘Alex Dunphy’, ‘Manny Delgado’ ],’Law Association’: [ ‘Mitchell Pritchett’ ],’Orchestra’ : [‘Alex Dunphy’ ],Clown School’ : [‘Cameron Tucker’ ],’Wizard of Oz Fan Club’: [‘Cameron Tucker’ ],’Real Estate Association’ : [‘Phil Dunphy’ ]}