def get_best_move(best_moves):
    '\n    Takes a list of tuples of\n    (first_move, number_of_moves, tile_coordinates), which might look like -\n    ((12, 22), 8, (17, 25))\n    ((12, 22), 8, (18, 24))\n    ((12, 22), 8, (19, 21))\n    ((13, 21), 6, (19, 21))\n    ((13, 23), 6, (17, 25))\n    ((13, 23), 6, (18, 24))\n    ((14, 22), 6, (17, 25))\n    ((14, 22), 6, (18, 24))\n    ((14, 22), 6, (19, 21))\n    And filters/sorts them to satisfy all the conditions\n    '
    if (not best_moves):
        return None
    min_steps = min([x[1] for x in best_moves])
    best_moves = [x for x in best_moves if (x[1] == min_steps)]
    best_moves.sort(key=(lambda x: x[2]))
    best_moves = [x for x in best_moves if (x[2] == best_moves[0][2])]
    best_moves.sort(key=(lambda x: x[0]))
    best_moves = [x for x in best_moves if (x[0] == best_moves[0][0])]
    return best_moves[0][0]
Takes a list of tuples of
(first_move, number_of_moves, tile_coordinates), which might look like -
((12, 22), 8, (17, 25))
((12, 22), 8, (18, 24))
((12, 22), 8, (19, 21))
((13, 21), 6, (19, 21))
((13, 23), 6, (17, 25))
((13, 23), 6, (18, 24))
((14, 22), 6, (17, 25))
((14, 22), 6, (18, 24))
((14, 22), 6, (19, 21))
And filters/sorts them to satisfy all the conditions
def get_best_move(best_moves):
    '\n    Takes a list of tuples of\n    (first_move, number_of_moves, tile_coordinates), which might look like -\n    ((12, 22), 8, (17, 25))\n    ((12, 22), 8, (18, 24))\n    ((12, 22), 8, (19, 21))\n    ((13, 21), 6, (19, 21))\n    ((13, 23), 6, (17, 25))\n    ((13, 23), 6, (18, 24))\n    ((14, 22), 6, (17, 25))\n    ((14, 22), 6, (18, 24))\n    ((14, 22), 6, (19, 21))\n    And filters/sorts them to satisfy all the conditions\n    '
    if (not best_moves):
        return None
    min_steps = min([x[1] for x in best_moves])
    best_moves = [x for x in best_moves if (x[1] == min_steps)]
    best_moves.sort(key=(lambda x: x[2]))
    best_moves = [x for x in best_moves if (x[2] == best_moves[0][2])]
    best_moves.sort(key=(lambda x: x[0]))
    best_moves = [x for x in best_moves if (x[0] == best_moves[0][0])]
    return best_moves[0][0]