There are two locations for this information. In some cases, you might need to look in both places (try primary first. If missed, try alternate).
Primary location:
host.hardware.systemInfo.serialNumber
Alternate location:
host.summary.hardware.otherIdentifyingInfo
In some of my systems, I cannot find the tags in the primary and traversing the alternate location helps find it. But between those two locations, I have always been able to get the tags. It might be a bit tricky to fish the info out. The following code should help.
if host.summary.hardware and host.summary.hardware.otherIdentifyingInfo:
for info in host.summary.hardware.otherIdentifyingInfo:
if info.identifierType and info.identifierType.key:
key = info.identifierType.key.lower()
if "serial" in key or "service" in key or "asset" in key:
if info.identifierValue and info.identifierValue.strip():
serial_number = info.identifierValue