def __repr__(self):
    if hasattr(self, 'name'):
        return ('<%s.%s (%r)>' % (self.__class__.__name__, self.name, self.value))
    name = '??'
    for x in type(self).__dict__:
        if (x.startswith('_') and x.endswith('_')):
            continue
        if (getattr(self, x, None) == self.value):
            name = x
            break
    return ('<%s.%s (%r)>' % (self.__class__.__name__, name, self.value))
def __repr__(self):
    if hasattr(self, 'name'):
        return ('<%s.%s (%r)>' % (self.__class__.__name__, self.name, self.value))
    name = '??'
    for x in type(self).__dict__:
        if (x.startswith('_') and x.endswith('_')):
            continue
        if (getattr(self, x, None) == self.value):
            name = x
            break
    return ('<%s.%s (%r)>' % (self.__class__.__name__, name, self.value))