import requests


def _authenticate(consumer_key, consumer_secret):
    """Authenticate with the Telstra API."""
    token_data = {
        'client_id': consumer_key,
        'client_secret': consumer_secret,
        'grant_type': 'client_credentials',
        'scope': 'SMS'
    }
    token_resource = 'https://api.telstra.com/v1/oauth/token'
    token_response = requests.get(
        token_resource, params=token_data, timeout=10).json()

    if 'error' in token_response:
        return False

    return token_response