Write a program that parses a stream of coordinate data and groups them into logical geographic clusters.
The function receives coordinate records formatted as "latitude,longitude" and a nonnegative distance threshold. Two coordinates belong to the same cluster when their Euclidean distance is at most the threshold, directly or through a chain of nearby coordinates.
Return clusters in order of the first coordinate encountered, with coordinates inside each cluster preserving stream order.
Function signature: def cluster_coordinates(records, threshold):
Input is an iterable of strings and a numeric threshold. Output is a list of coordinate lists.
def cluster_coordinates(records, threshold):