<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def group_distance(values, distance):
 """ Find groups of points which have neighbours closer than radius, where no two points in a group are farther than distance apart. Parameters --------- points : (n, d) float Points of dimension d distance : float Max distance between points in a cluster Returns unique : (m, d) float Median value of each group groups : (m) sequence of int Indexes of points that make up a group """

    values = np.asanyarray(values,
                           dtype=np.float64)

    consumed = np.zeros(len(values),
                        dtype=np.bool)
    tree = cKDTree(values)

    # (n, d) set of values that are unique
    unique = []
    # (n) sequence of indices in values
    groups = []

    for index, value in enumerate(values):
        if consumed[index]:
            continue
        group = np.array(tree.query_ball_point(value, distance),
                         dtype=np.int)
        consumed[group] = True
        unique.append(np.median(values[group], axis=0))
        groups.append(group)
    return np.array(unique), np.array(groups)