def __str__(self):
        """
        Customize string repesentation in Python 2.

        We can't have string representation containing unicode characters in Python 2.
        """
        if sys.version_info.major == 2:
            return self.message.encode('ascii', errors='ignore')
        else:
            return super(Error, self).__str__()
def __str__ ( self ) : if sys . version_info . major == 2 : return self . message . encode ( 'ascii' , errors = 'ignore' ) else : return super ( Error , self ) . __str__ ( )
Customize string repesentation in Python 2.

        We can't have string representation containing unicode characters in Python 2.