SF # 561244 Micro optimizations
SF # 561244 Micro optimizations

Cleanup code a bit and return as early as possible.

sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator