def extract_token_from_cookie(request):
    """Given a Request object, return a csrf_token.
    """
    try:
        token = request.headers.cookie['csrf_token'].value
    except __HOLE__:
        token = None
    else:
        token = _sanitize_token(token)

    # Don't set a CSRF cookie on assets, to avoid busting the cache.
    # Don't set it on callbacks, because we don't need it there.

    if request.path.raw.startswith('/assets/') or request.path.raw.startswith('/callbacks/'):
        token = None
    else:
        token = token or _get_new_token()

    return {'csrf_token': token}
dataset/ETHPy150Open gratipay/gratipay.com/gratipay/security/csrf.py/extract_token_from_cookie