<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def conduit_conductance(target, throat_conductance, throat_occupancy='throat.occupancy', pore_occupancy='pore.occupancy', mode='strict', factor=1e-6):
 r""" Determines the conductance of a pore-throat-pore conduit based on the invaded state of each element. Parameters target : OpenPNM Object The OpenPNM object where the model is attached. Should either be a Physics or a Phase. throat_conductance : string The transport conductance of the phase associated with the ``target`` object at single-phase conditions. pore_occupancy : string The property name containing the occupancy of the phase associated with the ``target`` object. An occupancy of 1 means the pore is completely filled with the phase and it fully conducts. throat_occupancy : string The property name containing the occupancy of the phase associated with the ``target`` object. An occupancy of 1 means the throat is completely filled with the phase and it fully conducts. mode : 'strict' or 'medium' or 'loose' How agressive the method should be when determining if a conduit is closed. **'strict'** : If any pore or throat in the conduit is unoccupied by the given phase, the conduit is closed. **'medium'** : If either the throat or both pores are unoccupied, the conduit is closed **'loose'** : Only close the conduit if the throat is unoccupied factor : float (default is 1e-6) The factor which becomes multiplied to the original conduit's conductance to severely limit transport, but not set it to zero. """

    network = target.project.network
    phase = target.project.find_phase(target)
    Tinv = phase[throat_occupancy] < 0.5
    P12 = network['throat.conns']
    Pinv = phase[pore_occupancy][P12] < 0.5
    if mode == 'loose':
        mask = Tinv
    elif mode == 'medium':
        mask = Tinv + sp.all(Pinv, axis=1)
    elif mode == 'strict':
        mask = Tinv + sp.any(Pinv, axis=1)
    else:
        raise Exception('Unrecongnized mode '+mode)
    value = phase[throat_conductance].copy()
    value[mask] = value[mask]*factor
    # Now map throats onto target object
    Ts = network.map_throats(throats=target.Ts, origin=target)
    return value[Ts]