code: def process_ticket(self):
          
          try:
              auth_req = self.root.getchildren()[1].getchildren()[0]
              ticket = auth_req.getchildren()[0].text
              ticket = models.Ticket.get(ticket)
              if ticket.service != self.target:
                  raise SamlValidateError(
                      u'AuthnFailed',
                      u'TARGET %s does not match ticket service' % self.target
                  )
              return ticket
          except (IndexError, KeyError):
              raise SamlValidateError(u'VersionMismatch')
          except Ticket.DoesNotExist:
              raise SamlValidateError(
                      u'AuthnFailed',
                      u'ticket %s should begin with PT- or ST-' % ticket
              )
          except (ServiceTicket.DoesNotExist, ProxyTicket.DoesNotExist):
              raise SamlValidateError(u'AuthnFailed', u'ticket %s not found' % ticket)
docs: validate ticket from SAML XML body
  
              :raises: SamlValidateError: if the ticket is not found or not valid, or if we fail
                  to parse the posted XML.
              :return: a ticket object
              :rtype: :class:`models.Ticket<cas_server.models.Ticket>`