Groome code to pep8 style.
I am sorry, but this very hard to read. Why not to use:
if ("subjects" not in inventory or not isinstance(inventory["subjects"], dict)):
Now I see that 'one' OR 'another'. Clear.
Pull-Request has been closed by astepano
Groome code to pep8 style.