[processors.starlark] Error: NoneType has no .find field or method

I setup a telegraf agent to snmp query a Linux host using [inputs.snmp] plugin:
name = “sysDescr”
oid = “.”
name = “root_filesystem_size_rhel7”
oid = “.”
name = “root_filesystem_used_rhel7”
oid = “.”

I added a [processors.starlark] plugin to process the data such as root filesystem size and usage before sending the data to InfluxDB. e.g.,
namepass = [“snmp”]
source = ‘’’
def apply(metric):
linuxos = metric.fields.get(‘sysDescr’)
if linuxos.find(“el7”) != -1:
metric.fields[‘root_filesystem_size’] = metric.fields[‘root_filesystem_size_rhel7’]
metric.fields[‘root_filesystem_used’] = metric.fields[‘root_filesystem_used_rhel7’]
return metric
return None
I see the data is sent to InfluxDB and shown correctly in both field ‘root_filesystem_size’ and ‘root_filesystem_used’ in influxDB. However, the telegraf agent log file shows the following error messages:

2023-02-05T16:40:04Z E! [processors.starlark] Traceback (most recent call last):
2023-02-05T16:40:04Z E! [processors.starlark] processor.starlark:3:13: in apply
2023-02-05T16:40:04Z E! [processors.starlark] Error: NoneType has no .find field or method
2023-02-05T16:40:04Z E! [processors.starlark] Error in plugin: NoneType has no .find field or method

Any suggestion/comment on how to fix these errors?

Thanks in advance!