def _authenticated(func):
 @functools.wraps(func)
 def func_wrapper(driver, *args, **kwargs):
  try:
   return func(driver, *args, **kwargs)
  except exception.NotAuthorized:
   if (args[0] == 'login'):
    raise
   driver.login()
   return func(driver, *args, **kwargs)
 return func_wrapper

def _authenticated ( func ) : @ functools . wraps ( func ) def func_wrapper ( driver , * args , ** kwargs ) : try : return func ( driver , * args , ** kwargs ) except exception . NotAuthorized : if ( args [ 0 ] == 'login' ) : raise driver . login ( ) return func ( driver , * args , ** kwargs ) return func_wrapper
ensure the driver is authenticated to make a request .