"gem"-module: replace python 2.5 language feature

replace conditional expression with python 2.4-compatible if/else
statements
Merge pull request #2502 from b6d/gem-module-fix

"gem"-module: replace python 2.5 language feature