I think this should be `isinstance(self.api_key, basestring)`.  Otherwise unicode strings will warn.