MNT: Changed if/elif/else block to use dictionary lookup