def _formatElement(element, count, index, lastSeparator):
    """Format an element from a sequence.

    This only prepends a separator for the last element and wraps each element
    with single quotes.

    Parameters
    ----------
    element : object
        Current element.
    count : int
        Total number of items in the sequence.
    index : int
        Current index.
    lastSeparator : str
        Separator to be used for joining the last element when multiple
        elements are to be joined.

    Returns
    -------
    str
        The joined object string representations.
    """
    return ("%s'%s'" % (lastSeparator, element)
            if count > 1 and index == count - 1
            else "'%s'" % (element,))