def login(verbose=None):
    global TOKEN
    if verbose == None:
        verbose = VERBOSE
    params = {'username': USERNAME, 'password': PASSWD}
    resp = api_call('login', params=params, authenticated=False, verbose=verbose)
    resp_json = resp.json()
    if 'token' in resp_json:
        token = resp.json()['token']
        TOKEN = token
        if verbose > 0:
            print(' => logged in and received token: {}'.format(token))
            print('--------------------------------------------')
    else:
        raise RuntimeError('Could not log in to the gateway')
    return token