def METHOD_NAME(self):
    request_data = {
        'grant_type': 'password',
        'username': self._username,
        'password': self._password,
    }
    headers = {
        'Authorization': 'Basic ' + base64.b64encode(b'codalab_worker_client:').decode('utf-8'),
        'Content-Type': 'application/x-www-form-urlencoded',
        'X-Requested-With': 'XMLHttpRequest',
    }
    request_to_send = urllib.request.Request(
        self._base_url + '/oauth2/token',
        data=urllib.parse.urlencode(request_data).encode('utf-8'),
    )
    for k, v in headers.items():
        request_to_send.add_unredirected_header(k, v)
    with closing(urlopen_with_retry(request_to_send)) as response:
        response_data = response.read().decode()
    try:
        token = json.loads(response_data)
    except ValueError:
        raise BundleServiceException('Invalid JSON: ' + response_data, False)
    if token['token_type'] != 'Bearer':
        raise BundleServiceException(
            'Unknown authorization token type: ' + token['token_type'], True
        )
    self._access_token = token['access_token']
    self._token_expiration_time = time.time() + token['expires_in']