def value_for_key(tuple_of_tuples, key):
 for t in tuple_of_tuples:
  if (t[0] == key):
   return t[1]
 else:
  return key

def value_for_key ( tuple_of_tuples , key ) : for t in tuple_of_tuples : if ( t [ 0 ] == key ) : return t [ 1 ] else : return key
processes a tuple of 2-element tuples and returns the value corresponding to the given key .