import math


def _expected_m0(ref_mean, t1, t2, pc, gain=1.0, alpha=1.0, te=0, tr=3.2, t2b=150):
    """
    Expected M0 value from reference region mean
    """
    #print("ref mean: ", ref_mean)
    m0 =  ref_mean / (1 - math.exp(- tr / t1))
    #print("T1 correction: ", m0)
    m0 = m0 / math.exp(-te/t2)
    m0 = m0 * gain / pc
    m0 = m0 * math.exp(-te/t2b)
    #print("T2 correction: ", m0)
    m0 *= alpha
    #print("IE correction: ", m0)
    return m0