code: def verify(self, msg, signature, key):
          
  
          if not isinstance(key, rsa.RSAPublicKey):
              raise TypeError(
                  "The public key must be an instance of RSAPublicKey")
          try:
              key.verify(signature, msg, self.padding, self.hash)
          except InvalidSignature as err:
              raise BadSignature(str(err))
          except AttributeError:
              return False
          else:
              return True
docs: Verifies whether signature is a valid signature for message
  
          :param msg: the message
          :type msg: bytes
          :param signature: The signature to be verified
          :type signature: bytes
          :param key: The key
          :return: True is the signature is valid otherwise False