def METHOD_NAME(self, attr_name):
    @bool_functor('%s.HasField("%s")' % (self.attr_name, attr_name))
    def BoolFunctor(ctx):
        obj = self.attr_getter(ctx)
        if hasattr(obj, "HasField"):
            return obj.METHOD_NAME(attr_name)
        else:
            return hasattr(obj, attr_name)
    return BoolFunctor