Btw my main problem is that when I assign the function to 'b' variable I only get the last key from the dictionary. Sorry about that I forgot to mention the main issue.