def maybe_single(sequence):
    """
    Given a sequence, if it contains exactly one item,
    return that item, otherwise return the sequence.
    Correlary function to always_iterable.

    >>> maybe_single(tuple('abcd'))
    ('a', 'b', 'c', 'd')
    >>> maybe_single(['a'])
    'a'
    """
    try:
        (single,) = sequence
    except ValueError:
        return sequence
    return single