def bounding_box(X):
    """
    Calculates the boundaries of a given dataset on all sides

    Parameters: 
        X - a data matrix where each row is a dimensional array of an item to be clustered

    Returns:
        Two tuples, where the first contains the minimum and maximum x values, and the 
        second contains the minimum and maximum y values
    """
    xmin, xmax = min(X,key=lambda a:a[0])[0], max(X,key=lambda a:a[0])[0]
    ymin, ymax = min(X,key=lambda a:a[1])[1], max(X,key=lambda a:a[1])[1]
    return (xmin,xmax), (ymin,ymax)