<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process(self, context, internal_response):
 """ Manage consent and attribute filtering :type context: satosa.context.Context :type internal_response: satosa.internal.InternalData :rtype: satosa.response.Response :param context: response context :param internal_response: the response :return: response """

        consent_state = context.state[STATE_KEY]

        internal_response.attributes = self._filter_attributes(internal_response.attributes, consent_state["filter"])
        id_hash = self._get_consent_id(internal_response.requester, internal_response.subject_id,
                                       internal_response.attributes)

        try:
            # Check if consent is already given
            consent_attributes = self._verify_consent(id_hash)
        except requests.exceptions.ConnectionError as e:
            satosa_logging(logger, logging.ERROR,
                           "Consent service is not reachable, no consent given.", context.state)
            # Send an internal_response without any attributes
            internal_response.attributes = {}
            return self._end_consent(context, internal_response)

        # Previous consent was given
        if consent_attributes is not None:
            satosa_logging(logger, logging.DEBUG, "Previous consent was given", context.state)
            internal_response.attributes = self._filter_attributes(internal_response.attributes, consent_attributes)
            return self._end_consent(context, internal_response)

        # No previous consent, request consent by user
        return self._approve_new_consent(context, internal_response, id_hash)