I want to use a public function defined in the python script. This script contains multiple functions and I want to use one specific function. Next I want to check some visual output while importing this script and the function in jupyter notebook. I need some help with jupyter notebook. ( How to import and use this function in jupyter notebook ?)
Here is the function I want to use and check its output visually in jupyter notebook:
 def merge_boxes_horizontally(boxes: Iterable[TextBox]) -> list[TextBoxCluster]:
    """
    Merge boxes that belong to one line.
    The algorithm does the following:
    1. Sort boxes by x-coordinate.
    2. Iterate through them and merge those that are close in x- and have
       overlap in y-direction to clusters.
    3. If the current box does not belong to a previously seen cluster,
       start a new cluster from the box.
    Parameters
    ----------
    boxes
        The boxes that shall be clustered.
    Returns
    -------
    List[TextBoxCluster]
        A list of the line segments that were found, sorted by y-coordinate.
    """
    boxes_sorted = sorted(boxes, key=lambda box: box.left)
    reference, *remainder = boxes_sorted
    clusters: dict[TextBox, list[TextBox]] = {reference: [reference]}
    for box in remainder:
        is_matched = False
        for reference, cluster in clusters.items():
            if has_sufficient_y_overlap(reference, box):
                *_, last_in_row = cluster
                if in_x_proximity(last_in_row, box):
                    cluster.append(box)
                    is_matched = True
                    break
        if not is_matched:
            clusters[box] = [box]
    return sorted(
        (TextBoxCluster(cluster) for cluster in clusters.values()),
        key=lambda box: box.top,
    )  
