def METHOD_NAME(self, username: str, password: str,
                 scopes: Optional[Sequence[str]] = None) -> str:
    data = {
        'username': username,
        'password': password,
    }
    # The form field name is scope (in singular), but it is actually a long
    # string with "scopes" separated by spaces.
    # https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/#scope
    if scopes:
        data['scope'] = ' '.join(scopes)
    url = self._make_url('/token')
    resp = requests.post(url, data, timeout=self._timeout)
    resp.raise_for_status()
    return resp.json()