Based on @batFINGER answer
The following allows for passing either a single string of a uv_map name to keep or a list of names to keep.
Since the function
rem_uvs takes a parameter reference of the object a check is made to ensure the object is a mesh type (which may have uv_maps). Attempts to iterate through objects that do not include
data.uv_layers would cause
AttributeError and the script would fail.
In order to avoid errors caused when modifying a loop control all items that are intended to be removed are 1st added to their own list. That list is then used to remove the uv_maps from the object.
Be sure to only use one of the 2 function calls at a time or include the single name in the list of names.
def rem_uvs(uvs_to_keep, ob):
uvs_to_rem = 
if type(uvs_to_keep) == 'str':
uvs_to_keep = list(uvs_to_keep)
if ob.type != 'MESH':
for uv in ob.data.uv_layers:
if uv.name in uvs_to_keep:
# providing single name to keep
# providing list of names to keep
names = [