def sanitize_str(s):
    """
    Ensures that s is a string. If it's a list or tuple then it joins the items
    into a string deliminated by a space.
    """
    if isinstance(s, (list, tuple, set)):
        return ', '.join([sanitize_str(x) for x in s])
    else:
        return s