def sort_matrix(matrix, col=0):
    """Sort a 2D matrix by a specific column.

    Args:
        matrix (ndarray): 2-column matrix
        col (int): column to sort by

    Returns:
        2-column matrix sorted by the given column

    """
    idx = matrix[:, (col)].argsort()
    return matrix[idx]
