def nearest_neighbor(x, tSet):
assert isinstance(x, tuple) and isinstance(tSet, dict)<EOL>current_key = ()<EOL>min_d = float('<STR_LIT>')<EOL>for key in tSet:<EOL><INDENT>d = distance(x, key)<EOL>if d < min_d:<EOL><INDENT>min_d = d<EOL>current_key = key<EOL><DEDENT><DEDENT>return tSet[current_key]<EOL>
[summary]
    Implements the nearest neighbor algorithm

    Arguments:
        x {[tupel]} -- [vector]
        tSet {[dict]} -- [training set]

    Returns:
        [type] -- [result of the AND-function]