def get_persistence(simplexTree, max_dimension):
    """Calculate the persistent homology of the abstract simplicial complex,
    filtering by positive values and dimensions.
    :param simplexTree: a simplcial complex, as returned by `build_local_complex`
    :type simplexTree: simplexTree
    :param max_dimension: max dimension of persistent homology to be returned.
    :type max_dimension: int.
    
    :returns: persistence diagram in the Gudhi format.
    :rtype: list of tuples (dim, (birth, death)).
    """
    pd = simplexTree.persistence()
    return [p for p in pd if (p[0] <= max_dimension) & (p[1][0] >= 0.)]