def validate_stb(stb):
    'validate structured traceback return type\n\n            return type of CustomTB *should* be a list of strings, but allow\n            single strings or None, which are harmless.\n\n            This function will *always* return a list of strings,\n            and will raise a TypeError if stb is inappropriate.\n            '
    msg = ('CustomTB must return list of strings, not %r' % stb)
    if (stb is None):
        return []
    elif isinstance(stb, str):
        return [stb]
    elif (not isinstance(stb, list)):
        raise TypeError(msg)
    for line in stb:
        if (not isinstance(line, str)):
            raise TypeError(msg)
    return stb
validate structured traceback return type

return type of CustomTB *should* be a list of strings, but allow
single strings or None, which are harmless.

This function will *always* return a list of strings,
and will raise a TypeError if stb is inappropriate.
def validate_stb(stb):
    'validate structured traceback return type\n\n            return type of CustomTB *should* be a list of strings, but allow\n            single strings or None, which are harmless.\n\n            This function will *always* return a list of strings,\n            and will raise a TypeError if stb is inappropriate.\n            '
    msg = ('CustomTB must return list of strings, not %r' % stb)
    if (stb is None):
        return []
    elif isinstance(stb, str):
        return [stb]
    elif (not isinstance(stb, list)):
        raise TypeError(msg)
    for line in stb:
        if (not isinstance(line, str)):
            raise TypeError(msg)
    return stb