code: def encode_cookie(payload, key=None):
      '''
      This will encode a ``unicode`` value into a cookie, and sign that cookie
      with the app's secret key.
  
      :param payload: The value to encode, as `unicode`.
      :type payload: unicode
  
      :param key: The key to use when creating the cookie digest. If not
                  specified, the SECRET_KEY value from app config will be used.
      :type key: str
      '''
      return u'{0}|{1}'.format(payload, _cookie_digest(payload, key=key)f encode_cookie(payload, key=None):
      '''
      This will encode a ``unicode`` value into a cookie, and sign that cookie
      with the app's secret key.
  
      :param payload: The value to encode, as `unicode`.
      :type payload: unicode
  
      :param key: The key to use when creating the cookie digest. If not
                  specified, the SECRET_KEY value from app config will be used.
      :type key: str
      '''
      return u'{0}|{1}'.format(payload, _cookie_digest(payload, key=key))
docs: This will encode a ``unicode`` value into a cookie, and sign that cookie
      with the app's secret key.
  
      :param payload: The value to encode, as `unicode`.
      :type payload: unicode
  
      :param key: The key to use when creating the cookie digest. If not
                  specified, the SECRET_KEY value from app config will be used.
      :type key: str