def sort_key(item):
    """ For sorting the results, we need a single key for the operation. Ideally
    we would have two keys, first sorting on number of visits, and then on the
    distance, both ascending. So, we can come up with a way offset the distances
    by adding a multiplier on visits. I am pretty sure distances don't exceed
    200 miles withing San Francisco, so we will multiply the visits by 200 and
    then add the distance to that. """

    key = 200 * item[1] + item[2]
    return key