def generate_session_id(secret_key=settings.secret_key_bytes(), signed=settings.sign_sessions()):
 secret_key = _ensure_bytes(secret_key)
 if signed:
  base_id = _get_random_string(secret_key=secret_key)
  return ((base_id + '-') + _signature(base_id, secret_key))
 else:
  return _get_random_string(secret_key=secret_key)

def generate_session_id ( secret_key = settings . secret_key_bytes ( ) , signed = settings . sign_sessions ( ) ) : secret_key = _ensure_bytes ( secret_key ) if signed : base_id = _get_random_string ( secret_key = secret_key ) return ( ( base_id + '-' ) + _signature ( base_id , secret_key ) ) else : return _get_random_string ( secret_key = secret_key )
generate a random session id .