def text_ends(text, pattern, case_sensitive=True):
    """
    Checks whether the text (also known as `text`) contains the text specified for `pattern` at the end.
    The no-data value None is passed through and therefore gets propagated.

    Parameters
    ----------
    text : str
        Text in which to find something at the end.
    pattern : str
        Text to find at the end of `text`.
    case_sensitive : bool, optional
        Case sensitive comparison can be disabled by setting this parameter to False (default is True).

    Returns
    -------
    bool :
        True if `text` ends with `pattern`, False otherwise.

    """
    if text is None:
        return None

    if case_sensitive:
        return text.endswith(pattern)
    else:
        return text.lower().endswith(pattern.lower())