def morsel_to_cookie(morsel):
 expires = None
 if morsel['max-age']:
  expires = (time.time() + morsel['max-age'])
 elif morsel['expires']:
  expires = morsel['expires']
  if (type(expires) == type('')):
   time_template = '%a, %d-%b-%Y %H:%M:%S GMT'
   expires = time.mktime(time.strptime(expires, time_template))
 c = create_cookie(name=morsel.key, value=morsel.value, version=(morsel['version'] or 0), port=None, domain=morsel['domain'], path=morsel['path'], secure=bool(morsel['secure']), expires=expires, discard=False, comment=morsel['comment'], comment_url=bool(morsel['comment']), rest={'HttpOnly': morsel['httponly']}, rfc2109=False)
 return c

def morsel_to_cookie ( morsel ) : expires = None if morsel [ 'max-age' ] : expires = ( time . time ( ) + morsel [ 'max-age' ] ) elif morsel [ 'expires' ] : expires = morsel [ 'expires' ] if ( type ( expires ) == type ( '' ) ) : time_template = '%a, %d-%b-%Y %H:%M:%S GMT' expires = time . mktime ( time . strptime ( expires , time_template ) ) c = create_cookie ( name = morsel . key , value = morsel . value , version = ( morsel [ 'version' ] or 0 ) , port = None , domain = morsel [ 'domain' ] , path = morsel [ 'path' ] , secure = bool ( morsel [ 'secure' ] ) , expires = expires , discard = False , comment = morsel [ 'comment' ] , comment_url = bool ( morsel [ 'comment' ] ) , rest = { 'HttpOnly' : morsel [ 'httponly' ] } , rfc2109 = False ) return c
convert a morsel object into a cookie containing the one k/v pair .