<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def unique(segments, digits=5):
 """ Find unique line segments. Parameters segments : (n, 2, (2|3)) float Line segments in space digits : int How many digits to consider when merging vertices Returns unique : (m, 2, (2|3)) float Segments with duplicates merged """

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

    # find segments as unique indexes so we can find duplicates
    inverse = grouping.unique_rows(
        segments.reshape((-1, segments.shape[2])),
        digits=digits)[1].reshape((-1, 2))

    # make sure rows are sorted
    inverse.sort(axis=1)
    # find rows that occur once
    index = grouping.unique_rows(inverse)
    # apply the unique mask
    unique = segments[index[0]]

    return unique