How can I efficiently convert my list into a dictionary in Python