The thing between double quotes in a DTML expression is a Python expression. Thus, you use Python as usual to test whether a string is in a tuple or is the i. element of a tuple -- you already did this in a Python script.
Your only problem is how to get at the equivalent of context
(--> read the DTML reference to find out) or how you get at the result of the method call without explicitly refering to the context (--> try dtml-let
).
This will be my last answer.