def soap_auth(client, tenant, username, password):
    """Authenticate to the web services"""

    if not tenant:
        return client.service.authenticate(
            username=username, password=password
        )
    return client.service.authenticateTenant(
        tenantName=tenant, username=username, password=password
    )