Constructed function to convert text to python dictionary.