def endswith(x, lst):
    """ Select longest suffix that matches x from provided list(lst)

    :param x: input string
    :param lst: suffixes to compare with
    :return: longest suffix that matches input string if available otherwise None
    """
    longest_suffix = None
    for suffix in lst:
        if x.endswith(suffix):
            if longest_suffix is None or len(longest_suffix) < len(suffix):
                longest_suffix = suffix
    return longest_suffix