def ensure_account(name):
 try:
  account = Account._by_name(name)
  print '>> found /u/{}'.format(name)
  return account
 except NotFound:
  print '>> registering /u/{}'.format(name)
  return register(name, 'password', '127.0.0.1')

def ensure_account ( name ) : try : account = Account . _by_name ( name ) print '>> found /u/{}' . format ( name ) return account except NotFound : print '>> registering /u/{}' . format ( name ) return register ( name , 'password' , '127.0.0.1' )
look up or register an account and return it .