def extract_token_from_cookie(request):
 try:
  token = request.headers.cookie[u'csrf_token'].value
 except KeyError:
  token = None
 else:
  token = _sanitize_token(token)
 if _requesting_asset(request):
  token = None
 else:
  token = (token or _get_new_token())
 return {u'csrf_token': token}

def extract_token_from_cookie ( request ) : try : token = request . headers . cookie [ u'csrf_token' ] . value except KeyError : token = None else : token = _sanitize_token ( token ) if _requesting_asset ( request ) : token = None else : token = ( token or _get_new_token ( ) ) return { u'csrf_token' : token }
given a request object .