def cookie_signature(seed, *parts):
 sha1 = hmac.new(seed, digestmod=hashlib.sha1)
 for part in parts:
  if part:
   sha1.update(part)
 return sha1.hexdigest()

def cookie_signature ( seed , * parts ) : sha1 = hmac . new ( seed , digestmod = hashlib . sha1 ) for part in parts : if part : sha1 . update ( part ) return sha1 . hexdigest ( )
generates a cookie signature .