def centroid_sort(centroids):
    """
        Sort centroids. This is required so that the same cluster centroid is always the 0th one. It should also be the \
        most negative. Order defined by the Euclidean distance between the centroid and an arbitrary "small" point \
        [-100, -100] (in each dimension) to account for possible negatives. Cluster 0 is the closest to that point, etc.

        0.  Set up

            >>> from numpy.testing import assert_array_equal

        1.  Single centroids just return themselves.

            >>> centroid_sort(array([[1.1, 2.2]]))

            array([[ 1.1,  2.2]])

            >>> centroid_sort(array([[1.1, 2.2, 3.3]]))

            array([[ 1.1,  2.2,  3.3]])

        2.  Positive 2d centroids are ordered.

            >>> centroids = array([
            ...     [5.34443858, 0.63266844],  # 3
            ...     [2.69156877, 0.76448578],  # 1
            ...     [4.74784197, 1.0815235 ],  # 2
            ...     [1.02330015, 0.16788118],  # 0
            ... ])
            >>> expected_sorted_centroids = array([
            ...     [1.02330015, 0.16788118],  # 0
            ...     [2.69156877, 0.76448578],  # 1
            ...     [4.74784197, 1.0815235 ],  # 2
            ...     [5.34443858, 0.63266844],  # 3
            ... ])
            >>> result = centroid_sort(centroids)
            >>> assert_array_equal(result, expected_sorted_centroids)

        3.  3d centroids spanning the origin are ordered.

            >>> centroids = array([
            ...     [ 3,   3,  4  ],  # 3
            ...     [ 1.5, 2,  3  ],  # 2
            ...     [-1,  -1, -1 ],   # 0
            ...     [ 0,   1,  0.5],  # 1
            ... ])
            >>> expected_sorted_centroids = array([
            ...     [-1,  -1, -1 ],   # 0
            ...     [ 0,   1,  0.5],  # 1
            ...     [ 1.5, 2,  3  ],  # 2
            ...     [ 3,   3,  4  ],  # 3
            ... ])
            >>> result = centroid_sort(centroids)
            >>> assert_array_equal(result, expected_sorted_centroids)

        :param centroids: array centroids
        :type centroids: numpy array
        :return centroids: array centroids
        :rtype centroids: numpy array

    """

    dimensions = len(centroids[0])
    negative_base_point = array(dimensions*[-100])

    decorated = [
        (euclidean(centroid, negative_base_point), centroid)
        for centroid in centroids
    ]
    decorated.sort()

    return array([centroid for dist, centroid in decorated])