'Get the setattr() implementation for the given attribute name
and signature.
The return value is a callable with the signature (builder, args).'

def get_setattr(self, attr, sig):

    assert (len(sig.args) == 2)
    typ = sig.args[0]
    valty = sig.args[1]
    def wrap_setattr(impl):
        def wrapped(builder, args):
            return impl(self, builder, sig, args, attr)
        return wrapped
    overloads = self._setattrs[attr]
    try:
        return wrap_setattr(overloads.find((typ, valty)))
    except NotImplementedError:
        pass
    overloads = self._setattrs[None]
    try:
        return wrap_setattr(overloads.find((typ, valty)))
    except NotImplementedError:
        pass
    raise NotImplementedError(('No    definition    for    lowering    %s.%s    =    %s' % (typ, attr, valty)))
