<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def correctly_signed_response(self, decoded_xml, must=False, origdoc=None, only_valid_cert=False, require_response_signature=False, **kwargs):
 """ Check if a instance is correctly signed, if we have metadata for the IdP that sent the info use that, if not use the key that are in the message if any. :param decoded_xml: The SAML message as a XML string :param must: Whether there must be a signature :param origdoc: :param only_valid_cert: :param require_response_signature: :return: None if the signature can not be verified otherwise an instance """


        response = samlp.any_response_from_string(decoded_xml)
        if not response:
            raise TypeError('Not a Response')

        if response.signature:
            if 'do_not_verify' in kwargs:
                pass
            else:
                self._check_signature(decoded_xml, response,
                                      class_name(response), origdoc)
        elif require_response_signature:
            raise SignatureError('Signature missing for response')

        return response