def _density_factor(density_units_in, density_units_out):
    """helper method for convert_density"""
    factor = 1.0
    if density_units_in == 'slug/ft^3':
        pass
    elif density_units_in == 'slinch/in^3':
        factor *= 12 ** 4
    elif density_units_in == 'kg/m^3':
        factor /= 515.378818
    else:
        msg = ('density_units_in=%r is not valid; use [slug/ft^3]' %
            density_units_in)
        raise RuntimeError(msg)
    if density_units_out == 'slug/ft^3':
        pass
    elif density_units_out == 'slinch/in^3':
        factor /= 12 ** 4
    elif density_units_out == 'kg/m^3':
        factor *= 515.378818
    else:
        msg = (
            'density_units_out=%r is not valid; use [slug/ft^3, slinch/in^3]' %
            density_units_out)
        raise RuntimeError(msg)
    return factor
