def _as_Ks(Ks=None, k=None, nu=1e-06, g=9.81):
    """
    Return the saturated hydraulic conductivity, computed from the instrinsic
    permeability if necessary.

    Parameters
    ----------
    Ks : float, optional
        :math:`K_S`, the saturated hydraulic conductivity. Must be positive. If
        neither `Ks` nor `k` are given, the saturated hydraulic conductivity is
        assumed to be 1.
    k : float, optional
        Intrinsic permeability of the porous medium. Can be given in place of
        `Ks`, which results in the saturated hydraulic conductivity being
        computed using :math:`K_S = kg/\\nu`. Must be positive.
    nu : float, optional
        :math:`\\nu`, the kinematic viscosity of the wetting fluid. Only used if
        `k` is passed instead of `Ks`. Must be positive. Defaults to 1e-6,
        approximately the kinematic viscosity of water at 20°C in SI units.
    g : float, optional
        Magnitude of the gravitational acceleration. Only used if `k` is passed
        instead of `Ks`. Must be positive. Defaults to 9.81, the gravity of 
        Earth in SI units.

    Returns
    -------
    Ks : float
        :math:`K_S`, the saturated hydraulic conductivity
    """
    if Ks is not None:
        if k is not None:
            raise TypeError('cannot pass both Ks and k')
        if Ks <= 0:
            raise ValueError('Ks must be positive')
        return Ks
    elif k is not None:
        if k <= 0:
            raise ValueError('k must be positive')
        if nu <= 0:
            raise ValueError('nu must be positive')
        if g <= 0:
            raise ValueError('g must be positive')
        return g * k / nu
    else:
        return 1
