How to check if a tag is part of a UDT or not?

Before I write something, is there a tag property I'm unaware of to flag if a tag is part of a UDT instance or not?

Basically, I have a script that pulls out the alarm info for all tags that have alarms from a given path, but I also want to know if the tags are within UDTs so that I can filter them out in Excel and then bulk configure the non-UDT ones. (However I still want the UDT tags in there as well)

I could run the tag.query function again setting includeUdtMembers: False, but then I'd be running it twice and then have to combine the results together... maybe not so bad for my use-case. It'd be nice for other uses though if there was a tag prop to read

I’m curious as well. I ended up querying twice (perhaps even a third) for my need to ‘quickly’ get through a similar task - fully quantifying all types of historical tag configurations (of a base tag, within a base UDT definition, instance UDT w/ override, nested UDT instance within a UDT def - w/ override, etc.).

I imagine that this ‘controlling definition’ property (or equivalent argument as an input to a query) would be a very useful one.

I've got this at the moment. It's not too bad..

baseTagPath = '*'
provider = 'default'
query = {
    "options": {
      "includeUdtDefinitions": False
    },
    "condition": {
      "path": baseTagPath,
      "attributes": {
        "values": [
          "alarm"
        ],
        "requireAll": True
      }
    },
    "returnProperties": [
      "alarms"
    ]
}

# get the tags not in UDTs - the only reason we need this is to know which tags are NOT in UDTs
query['options']['includeUdtMembers'] = False
alarmTagDetails_NonUDT = system.tag.query(provider, query)
# get all tags, including those inside of UDTs
query['options']['includeUdtMembers'] = True
alarmTagDetails = system.tag.query(provider, query)

# add a flag to identify if the tag is in a UDT or not - initially set all to True, then update later
for item in alarmTagDetails:
	item['inUdt'] = True

# we need a map to link fullPaths to their list indices
fullPathIndexLookup = {item['fullPath']: i for i, item in enumerate(alarmTagDetails)}
for item in alarmTagDetails_NonUDT:
	# overwrite the "inUdt" flag to False
	alarmTagDetails[fullPathIndexLookup[item['fullPath']]]['inUdt'] = False

In the DB the UUIDs are different, if that helps (you get f"{folder ID}.{tag ID}" for UDT members), but I'm not sure if you can pull out the UUID of tags from property