Nornir and Telegraf

Hi,
I need help understanding problem which I have using nornir as tool to get data from network and pass the data to other function to produce data in influx format ,so it can be used by Telegraf input plugin.
This is what i get from telegraf --test
telegraf --test --config /etc/telegraf/telegraf.d/nr-ont_onlinr.conf
2020-04-25T20:23:01Z E! Error in plugin [inputs.exec]: metric parse error: expected field at offset 25: "olt online=0i,offline=0i\x1b[0m\n\x1b[0msatt-srb-turija-gpon-olt-1 online=0i,offline=0i\x1b[0m\n\x1b[0msatt-srb-moravica-olt-1 online=0i,offline=0i\x1b[0m\n\x1b[0msatt-srb-orom-olt-1

This is my script
from nornir import InitNornir
from nornir.core.filter import F
from nornir.plugins.tasks import text, files
from nornir.plugins.functions.text import print_result
from nornir.plugins.tasks.networking import netmiko_send_command
from itertools import count

def print_influx_metrics(olt_hostname,data):
data_string = “”
cnt = count()
for measure, value in data.items():
if next(cnt) > 0:
data_string += “,”
data_string += f"{measure}={value}i"
print(f"{olt_hostname} {data_string}")
return True

nr = InitNornir(
inventory={
“options”: {
“host_file”: “/home/srdjan/telegraf_exec_plugins/inventory/hosts.yaml”,
“group_file”: “/home/srdjan/telegraf_exec_plugins/inventory/groups.yaml”,
“defaults_file”: “/home/srdjan/telegraf_exec_plugins/inventory/defaults.yaml”,
}
}
)

olt_devices = nr.filter(platform=“eltex”)
cmd = “show interface ont 0-15 configured”
r = olt_devices.run(name=“olt_grab_info”, task=netmiko_send_command, command_string=cmd)

for host, task_results in r.items():

print(task_results) #MultiResult

my_task = task_results[0]             #
my_task_result = my_task.result.splitlines()       
counter_online = 0
counter_offline = 0

for line in my_task_result:
    if 'OK' in line:
        counter_online+=1
    elif 'OFFLINE' in line:
        counter_offline+=1

print(counter_online, counter_offline)

data = {"online": counter_online, "offline": counter_offline }
olt_hostname = str(host.strip())

print_influx_metrics(olt_hostname, data)

If I run python script just using netmiko , there is no problem! But it is too slow.
I am not python developer, just NetEng with little knowledge of python.
Can You help me to solve this problem?