def get_center(centers, vector, distance_function):
    """
    Determines which center is closest to the given vector.

    The given distance function will be used to calculate the distance between
    the vector and possible centers.

    The centers should be a list of numpy vectors, and vector should be a numpy
    vector.

    :param centers: the centers to check
    :param vector: the vector to check
    :param distance_function: the distance function to use

    :return: the center closest to the given vector
    """

    min_distance = None
    min_center = None

    for center in centers:
        distance = distance_function(center, vector)

        if min_distance is None or distance < min_distance:
            min_distance = distance
            min_center = center

    return min_center