There should be an ``else`` here just for clarity. You can either replace the ``elif`` with an ``else`` or add an ``else`` which just raises error by calling ``option_parser.error``, otherwise there could potentially a path to output_dir being ``None`` (not sure when ``isfile`` and ``isdir`` would both fail, but maybe if doesn't exist?).