docs: def get_closest_clusters(cluster_id, cluster_ids, sim_func, max_n=None):
      """Return a list of pairs `(cluster, similarity)` sorted by decreasing
      similarity to a given cluster."""
      l = [(_as_scalar(candidate), _as_scalar(sim_func(cluster_id, candidate)))
           for candidate in _as_scalars(cluster_ids)]
      l = sorted(l, key=itemgetter(1), reverse=True)
      max_n = None or len(l)
      return l[:max_n]