def _format_element(element, count, idx, 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 idx == count - 1 else "'%s'" % (element,)
