'set zmq options by attribute'

def __setattr__(self, key, value):

    for obj in ([self] + self.__class__.mro()):
        if (key in obj.__dict__):
            object.__setattr__(self, key, value)
            return
    upper_key = key.upper()
    try:
        opt = getattr(constants, upper_key)
    except AttributeError:
        raise AttributeError(('%s    has    no    such    option:    %s' % (self.__class__.__name__, upper_key)))
    else:
        self._set_attr_opt(upper_key, opt, value)
