code: def _parse_request(self, enc_request, request_cls, service, binding):
          
  
          _log_info = logger.info
          _log_debug = logger.debug
  
          # The addresses I should receive messages like this on
          receiver_addresses = self.config.endpoint(service, binding,
                                                    self.entity_type)
          if not receiver_addresses and self.entity_type == "idp":
              for typ in ["aa", "aq", "pdp"]:
                  receiver_addresses = self.config.endpoint(service, binding, typ)
                  if receiver_addresses:
                      break
  
          _log_debug("receiver addresses: %s", receiver_addresses)
          _log_debug("Binding: %s", binding)
  
          try:
              timeslack = self.config.accepted_time_diff
              if not timeslack:
                  timeslack = 0
          except AttributeError:
              timeslack = 0
  
          _request = request_cls(self.sec, receiver_addresses,
                                 self.config.attribute_converters,
                                 timeslack=timeslack)
  
          xmlstr = self.unravel(enc_request, binding, request_cls.msgtype)
          must = self.config.getattr("want_authn_requests_signed", "idp")
          only_valid_cert = self.config.getattr(
              "want_authn_requests_only_with_valid_cert", "idp")
          if only_valid_cert is None:
              only_valid_cert = False
          if only_valid_cert:
              must = True
          _request = _request.loads(xmlstr, binding, origdoc=enc_request,
                                    must=must, only_valid_cert=only_valid_cert)
  
          _log_debug("Loaded request")
  
          if _request:
              _request = _request.verify()
              _log_debug("Verified request")
  
          if not _request:
              return None
          else:
              return _request
docs: Parse a Request
  
          :param enc_request: The request in its transport format
          :param request_cls: The type of requests I expect
          :param service:
          :param binding: Which binding that was used to transport the message
              to this entity.
          :return: A request instance