<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def login( username: str, password: str, brand: str, websession: ClientSession = None) -> API: """Log in to the API."""

    api = API(brand, websession)
    await api.authenticate(username, password)
    return api