def replace_if_match(xs, y):
    """
    Find the first pattern match in list.

    Return the corresponding value of patterns if matches,
    return the same value of x if there has no match.
    Parameters
    ----------
    xs : [(pattern, value)]
    y : object

    Returns
    -------
    result : object
    """
    # Find the first match in ys
    matches = next(filter(lambda tup: tup[0] == y, xs), None)
    if matches is None:
        return y
    else:
        return matches[1]