CheckBuffer is alread a lighweight macro, from python abstract.h:

    #define PyObject_CheckBuffer(obj) \
        (((obj)->ob_type->tp_as_buffer != NULL) &&                          \
         (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_NEWBUFFER)) && \
         ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL))