def dist_erp(p_1, p_2, mat, g=1000):
    """
    Finds cost between two points. Outputs g if either point is a gap.
    Parameters
    ----------
    p_1 : str
        ID of point.
    p_2 : str
        ID of other point.
    mat : dict
        Normalized cost matrix.
    g : int/float, optional
        Gap penalty. The default is 1000.
    Returns
    -------
    dist : int/float
        Cost of substituting one point for the other.
    """
    if p_1 == "gap" or p_2 == "gap":
        dist = g
    else:
        dist = mat[p_1][p_2]
    return dist