

def dump_cookie(key, value='', max_age=None, expires=None, path='/', domain=None, secure=False, httponly=False, charset='utf-8', sync_expires=True):
    'Creates a new Set-Cookie header without the ``Set-Cookie`` prefix\n    The parameters are the same as in the cookie Morsel object in the\n    Python standard library but it accepts unicode data, too.\n\n    On Python 3 the return value of this function will be a unicode\n    string, on Python 2 it will be a native string.  In both cases the\n    return value is usually restricted to ascii as the vast majority of\n    values are properly escaped, but that is no guarantee.  If a unicode\n    string is returned it\'s tunneled through latin1 as required by\n    PEP 3333.\n\n    The return value is not ASCII safe if the key contains unicode\n    characters.  This is technically against the specification but\n    happens in the wild.  It\'s strongly recommended to not use\n    non-ASCII values for the keys.\n\n    :param max_age: should be a number of seconds, or `None` (default) if\n                    the cookie should last only as long as the client\'s\n                    browser session.  Additionally `timedelta` objects\n                    are accepted, too.\n    :param expires: should be a `datetime` object or unix timestamp.\n    :param path: limits the cookie to a given path, per default it will\n                 span the whole domain.\n    :param domain: Use this if you want to set a cross-domain cookie. For\n                   example, ``domain=".example.com"`` will set a cookie\n                   that is readable by the domain ``www.example.com``,\n                   ``foo.example.com`` etc. Otherwise, a cookie will only\n                   be readable by the domain that set it.\n    :param secure: The cookie will only be available via HTTPS\n    :param httponly: disallow JavaScript to access the cookie.  This is an\n                     extension to the cookie standard and probably not\n                     supported by all browsers.\n    :param charset: the encoding for unicode values.\n    :param sync_expires: automatically set expires if max_age is defined\n                         but expires not.\n    '
    key = to_bytes(key, charset)
    value = to_bytes(value, charset)
    if (path is not None):
        path = iri_to_uri(path, charset)
    domain = _make_cookie_domain(domain)
    if isinstance(max_age, timedelta):
        max_age = ((((max_age.days * 60) * 60) * 24) + max_age.seconds)
    if (expires is not None):
        if (not isinstance(expires, string_types)):
            expires = cookie_date(expires)
    elif ((max_age is not None) and sync_expires):
        expires = to_bytes(cookie_date((time() + max_age)))
    buf = [((key + b'=') + _cookie_quote(value))]
    for (k, v, q) in ((b'Domain', domain, True), (b'Expires', expires, False), (b'Max-Age', max_age, False), (b'Secure', secure, None), (b'HttpOnly', httponly, None), (b'Path', path, False)):
        if (q is None):
            if v:
                buf.append(k)
            continue
        if (sync_expires is None):
            continue
        tmp = bytearray(k)
        if (not isinstance(v, (bytes, bytearray))):
            v = to_bytes(text_type(v), charset)
        if q:
            v = _cookie_quote(v)
        tmp += (b'=' + v)
        buf.append(bytes(tmp))
    rv = b'; '.join(buf)
    if (not PY2):
        rv = rv.decode('latin1')
    return rv

dataset/ETHPy150Open Eforcers/gae-flask-todo/lib/werkzeug/http.py dump_cookie/VarMisuse@296/1106 `v`->`sync_expires`