You probably want to prebuild this lookup table into a dict rather than do the string manipulation and `getattr` on the fly.