self._parse(fp)
if fp is not None
.
Note that this is only one way, albeit the most convenient way, to make the _ function available to your application. Because it affects the entire application globally, and specifically the built-in namespace, localized modules should never install _. Instead, they should use this code to make _ available to their module:
import gettext t = gettext.translation('mymodule', ...) _ = t.gettext
This puts _ only in the module's global namespace and so only affects calls within this module.