def medoid(data, indexes=None, **kwargs):
index_median = None<EOL>distance = float('<STR_LIT>')<EOL>metric = kwargs.get('<STR_LIT>', type_metric.EUCLIDEAN_SQUARE)<EOL>data_type = kwargs.get('<STR_LIT>', '<STR_LIT>')<EOL>if data_type == '<STR_LIT>':<EOL><INDENT>calculator = lambda index1, index2: metric(data[index1], data[index2])<EOL><DEDENT>elif data_type == '<STR_LIT>':<EOL><INDENT>if isinstance(data, numpy.matrix):<EOL><INDENT>calculator = lambda index1, index2: data.item(index1, index2)<EOL><DEDENT>else:<EOL><INDENT>calculator = lambda index1, index2: data[index1][index2]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>" % data_type)<EOL><DEDENT>if indexes is None:<EOL><INDENT>range_points = range(len(data))<EOL><DEDENT>else:<EOL><INDENT>range_points = indexes<EOL><DEDENT>for index_candidate in range_points:<EOL><INDENT>distance_candidate = <NUM_LIT:0.0><EOL>for index in range_points:<EOL><INDENT>distance_candidate += calculator(index_candidate, index)<EOL><DEDENT>if distance_candidate < distance:<EOL><INDENT>distance = distance_candidate<EOL>index_median = index_candidate<EOL><DEDENT><DEDENT>return index_median<EOL>
!
    @brief Calculate medoid for input points using Euclidean distance.

    @param[in] data (list): Set of points for that median should be calculated.
    @param[in] indexes (list): Indexes of input set of points that will be taken into account during median calculation.
    @param[in] **kwargs: Arbitrary keyword arguments (available arguments: 'metric', 'data_type').

    <b>Keyword Args:</b><br>
        - metric (distance_metric): Metric that is used for distance calculation between two points.
        - data_type (string): Data type of input sample 'data' (available values: 'points', 'distance_matrix').

    @return (uint) index of point in input set that corresponds to median.