I have a key, K, that I use to sign an X509 certificate, X.

Later, a certificate Y arrives (this certificate Y may be the same as
X; we do not know), and I want to verify whether or not it was signed
by K.

Intuitively, I want to do something like X509_verify(Y, K). In my
mindset, this should be one of the basic building blocks of
certificate signature and verification. However, I can find no way to
do this. I'm using a python library called M2Crypto that returns False
when I do this, with no further information. I can find no equivalent
command to issue to the openssl command-line tool to diagnose the
problem interactively.

Can anyone help? Am I viewing this problem the wrong way? All I want
to know is whether or not a certificate was signed by a particular
public key.