import requests


def get_tnstats(url, cookie):
    """
    Retrieve Tunneled Node's agregated statistics
    :param url: base url
    :param cookie: Cookie value
    :return: TN Statisctics JSON
    :Example:

    result = get_tnstats(base_url, sessionid)
    """
    header = {'cookie': cookie}
    get_tn_stats = requests.get(url + "tunneled_node_server/ports/aggregate_statistics", headers=header, verify=False,
                                timeout=2)
    return get_tn_stats.json()