2
If you want to compare with the username, you should do that, rather than comparing with the string representation of the User object; they may be the same, but they probably aren’t.
ig_username = user.username
Also, not related to your problem but you should really use the Instagram Python library, which makes this sort of thing a bit easier.
Source:stackexchange.com