def _format_element(element, count, index, last_separator):
    """Format an element from a sequence.

    This only prepends a separator for the last element and wraps each element
    with single quotes.
    """
    return ("%s'%s'" % (last_separator, element)
            if count > 1 and index == count - 1
            else "'%s'" % (element,))