docs: def verify_ticket(self, ticket, **kwargs):
          """Verifies CAS 3.0+ XML-based authentication ticket and returns extended attributes.
  
          @date: 2011-11-30
          @author: Carlos Gonzalez Vila <carlewis@gmail.com>
  
          Returns username and attributes on success and None,None on failure.
          """
  
          try:
              from xml.etree import ElementTree
          except ImportError:
              from elementtree import ElementTree
  
          page = self.fetch_saml_validation(ticket)
  
          try:
              user = None
              attributes = {}
              response = page.content
              tree = ElementTree.fromstring(response)
              # Find the authentication status
              success = tree.find('.//' + SAML_1_0_PROTOCOL_NS + 'StatusCode')
              if success is not None and success.attrib['Value'].endswith(':Success'):
                  # User is validated
                  name_identifier = tree.find('.//' + SAML_1_0_ASSERTION_NS + 'NameIdentifier')
                  if name_identifier is not None:
                      user = name_identifier.text
                  attrs = tree.findall('.//' + SAML_1_0_ASSERTION_NS + 'Attribute')
                  for at in attrs:
                      if self.username_attribute in list(at.attrib.values()):
                          user = at.find(SAML_1_0_ASSERTION_NS + 'AttributeValue').text
                          attributes['uid'] = user
  
                      values = at.findall(SAML_1_0_ASSERTION_NS + 'AttributeValue')
                      if len(values) > 1:
                          values_array = []
                          for v in values:
                              values_array.append(v.text)
                              attributes[at.attrib['AttributeName']] = values_array
                      else:
                          attributes[at.attrib['AttributeName']] = values[0].text
              return user, attributes, None
          finally:
              page.close()