def joined_seq(seq, sep=None):
joined_seq = tuple(seq)<EOL>if isinstance(sep, basestring):<EOL><INDENT>joined_seq = sep.join(str(item) for item in joined_seq)<EOL><DEDENT>return joined_seq<EOL>
r"""Join a sequence into a tuple or a concatenated string

    >>> joined_seq(range(3), ', ')
    '0, 1, 2'
    >>> joined_seq([1, 2, 3])
    (1, 2, 3)