def closestValue(aList: list, givenV: int):
    """
    Return the nearest value to a given one in a list.
    """
    abs_diff = lambda list_value: abs(list_value - givenV)

    return min(aList, key=abs_diff)