def mass_attenuation_coefficient(mu, rho, convert_to_um=False):
    """
    Calculate the x-ray mass attenuation coefficient (mum) for a given density
    (rho):
        mum = mu/rho

    Parameters
    ==========

    mu: x-ray attenuation coefficient [1/um]
    rho: density [g/cm3]
    covnert_to_um: convert mum to g/um2, default=False

    Returns
    =======

    mum: x-ray mass attenuation coefficient [cm2/g], [um2/g] if
    covnert_to_um=True

    Notes
    =====

    beta and energy need to be the same length, as delta = delta(energy)

    Examples
    ========

    mass_attenuation_coefficient(0.049371851838870218, 19.3)
    25.581270382834308
    # [cm2/g]

    mass_attenuation_coefficient(0.049371851838870218, 19.3,
    convert_to_um=True)
    2558127038.283431
    # [um2/g]

    """
    mum = mu*1e4/rho  # [ (1/um -> 1/cm) / (g/cm3) = cm2/g ]
    if convert_to_um:
        mum = mum*1e8  # [ cm2/g -> um2/g]
    return mum