def density_conv(D, from_units, to_units):
    """
    Convert density values between kg/m**3, slug/ft**3 and lb/ft**3.

    The incoming value is first converted to kg/m**3, then it is converted
    to desired return value.

    There are no default units. Both the from_units and the to_units must
    be specified.

    Example:

    Convert 1.225 kg per metre cubed to lb per foot cubed:
    >>> density_conv(1.225, from_units = 'kg/m**3', to_units = 'lb/ft**3')
    0.076474253491112101

    """
    if from_units == 'kg/m**3':
        pass
    elif from_units == 'slug/ft**3':
        D *= 515.37882
    elif from_units == 'lb/ft**3':
        D *= 16.018463
    else:
        raise ValueError(
            'from_units must be one of "kg/m**3", "slug/ft**3" and "lb/ft**3".'
            )
    if to_units == 'kg/m**3':
        return D
    elif to_units == 'slug/ft**3':
        return D / 515.37882
    elif to_units == 'lb/ft**3':
        return D / 16.018463
    else:
        raise ValueError(
            'to_units must be one of "kg/m**3", "slug/ft**3" and "lb/ft**3".')
