Refactor two ugly lines into one more Pythonic one.