<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getNumNetworkWithConnection(self, connection):
 """Return the number of network interfaces with id ``connection``."""


        i = 0
        while True:
            value = self.getValue("net_interface.%d.connection" % i, None)
            if not value:
                return None
            if value == connection:
                return i
            i += 1