def METHOD_NAME(self, M, S, t="pkcs", h="sha256", mgf=None, L=None):
    M = bytes_encode(M)
    mgf = mgf or padding.MGF1
    h = _get_hash(h)
    pad = _get_padding(t, mgf, h, L)
    try:
        try:
            self.pubkey.METHOD_NAME(S, M, pad, h)
        except UnsupportedAlgorithm:
            if t != "pkcs" and h != "md5-sha1":
                raise UnsupportedAlgorithm("RSA verification with %s" % h)
            self._legacy_verify_md5_sha1(M, S)
        return True
    except InvalidSignature:
        return False