code: def validate_proxy_ticket(service, ticket, pgturl=None):
      
      logger.debug("Proxy validation request received for %s" % ticket)
  
      pt = ProxyTicket.objects.validate_ticket(ticket, service)
      attributes = get_attributes(pt.user, pt.service)
  
      # Build a list of all services that proxied authentication,
      # in reverse order of which they were traversed
      proxies = [pt.service]
      prior_pt = pt.granted_by_pgt.granted_by_pt
      while prior_pt:
          proxies.append(prior_pt.service)
          prior_pt = prior_pt.granted_by_pgt.granted_by_pt
  
      if pgturl is not None:
          logger.debug("Proxy-granting ticket request received for %s" % pgturl)
          pgt = ProxyGrantingTicket.objects.create_ticket(service, pgturl, user=pt.user, granted_by_pt=pt)
      else:
          pgt = None
      return pt, attributes, pgt, proxies
docs: Validate a proxy ticket string. Return a 4-tuple containing a
      ``ProxyTicket``, an optional ``ProxyGrantingTicket`` and a list
      of proxies through which authentication proceeded, or a
      ``ValidationError`` if ticket validation failed.