def parse_auth_header(header):
 parts = header.split()
 if (parts[0].lower() != 'bearer'):
  raise CasTokenError('Unsupported authorization type')
 elif (len(parts) == 1):
  raise CasTokenError('Missing token')
 elif (len(parts) > 2):
  raise CasTokenError('Token contains spaces')
 return parts[1]

def parse_auth_header ( header ) : parts = header . split ( ) if ( parts [ 0 ] . lower ( ) != 'bearer' ) : raise CasTokenError ( 'Unsupported authorization type' ) elif ( len ( parts ) == 1 ) : raise CasTokenError ( 'Missing token' ) elif ( len ( parts ) > 2 ) : raise CasTokenError ( 'Token contains spaces' ) return parts [ 1 ]
given an authorization header string .