def ensure_tuple ( obj ) : if obj is None : return tuple ( ) if isinstance ( obj , Iterable ) and not isinstance ( obj , six . string_types ) : return tuple ( obj ) return obj ,
how to use isinstance python 3 for tuple
Try and make the given argument into a tuple .
def ensure_tuple(obj):
    """Try and make the given argument into a tuple."""
    if obj is None:
        return tuple()
    if isinstance(obj, Iterable) and not isinstance(obj, six.string_types):
        return tuple(obj)
    return obj,