BUG: Compare strings for equality, not identity.

Strings in Python are usually interned (https://en.wikipedia.org/wiki/String_interning) but not always, so comparing identity can fail.
Merge pull request #2558 from Jorge-C/patch-1

BUG: Compare strings for equality, not identity.