def get_exchange_trading_pair(table_name):
    """Function to get exchange and trading_pair bc coinbase_pro has an extra '_' """

    # for coinbase_pro
    if len(table_name.split('_')) == 4:
        exchange = table_name.split('_')[0] + '_' + table_name.split('_')[1]
        trading_pair = table_name.split('_')[2] + '_' + table_name.split('_')[3]

    # for all other exchanges
    else:
        exchange = table_name.split('_')[0]
        trading_pair = table_name.split('_')[1] + '_' + table_name.split('_')[2]

    return exchange, trading_pair