Check if obj is string.
Deprecated since version 2.6: This is deprecated and will be removed in NetworkX v3.0.