Python - MySQL Dictionary Generator