def _get_accounts_client(accounts_url, email, password):
    """
    Create an Accounts Service API client and log in using provided email and password
    :param accounts_url: Accounts Service URL
    :param email: Login Email
    :param password: Login Password
    :return: Accounts Service API Client
    """
    client = API(accounts_url, async=False, validate_cert=False)
    try:
        response = client.accounts.login.post(email=email, password=password)
        client.default_headers['Authorization'] = response['data']['token']
        return client
    except httpclient.HTTPError:
        msg = ('There was a problem logging into the accounts service.'
               ' Please check your email and password.')
        raise click.ClickException(click.style(msg, fg='red'))