def validate_response(self, data, status_code, headers):
        """
        Validates the Response object based on what has been declared in the specification.
        Ensures the response body matches the declated schema.
        :type data: dict
        :type status_code: int
        :type headers: dict
        :rtype bool | None
        """
        response_definitions = self.operation.operation["responses"]
        response_definition = response_definitions.get(str(status_code), {})
        response_definition = self.operation.resolve_reference(response_definition)
        # TODO handle default response definitions

        if self.is_json_schema_compatible(response_definition):
            schema = response_definition.get("schema")
            v = ResponseBodyValidator(schema)
            try:
                # For cases of custom encoders, we need to encode and decode to
                # transform to the actual types that are going to be returned.
                data = json.dumps(data)
                data = json.loads(data)

                v.validate_schema(data)
            except __HOLE__ as e:
                raise NonConformingResponseBody(message=str(e))

        if response_definition and response_definition.get("headers"):
            response_definition_header_keys = response_definition.get("headers").keys()
            if not all(item in headers.keys() for item in response_definition_header_keys):
                raise NonConformingResponseHeaders(
                    message="Keys in header don't match response specification. Difference: %s"
                    % list(set(headers.keys()).symmetric_difference(set(response_definition_header_keys))))
        return True
dataset/ETHPy150Open zalando/connexion/connexion/decorators/response.py/ResponseValidator.validate_response