from typing import Optional
from typing import Sequence
from typing import Union
from typing import List


def rjoin(sep: Optional[str], array: Sequence[str]) -> Union[str, List[str]]:
    """Concatenate string with additional separator at the end.

    Return a string which is the concatenation of the strings in iterable.
    The 'sep' string is used as separator between elements of array and
    is appended to the end of result, unless the array is empty. The 'sep'
    argument can be 'None' is which case original array is returned.
    """
    if sep is not None:
        if len(array) == 0:
            return ''
        return sep.join(array) + sep
    return list(array)