def getInterfaceConnection(self, interface, protocol):
        """ Get the connection between an interface and a protocol.

            @param interface:   Interface which belongs to this endpoint and
                                which is on one side of the connection.
            @type  interface:   rce.core.network.Interface

            @param protocol:    Protocol which belongs to this endpoint and
                                which is on one side of the connection.
            @type  protocol:    rce.core.network.Protocol

            @return:            Connection between the interface and the
                                protocol.
            @rtype:             rce.core.network.InterfaceConnection
        """
        try:
            connectionI = self._interfaces[interface]
        except KeyError:
            raise InternalError('Interface does not belong to this endpoint.')

        try:
            connectionP = self._protocols[protocol]
        except __HOLE__:
            raise InternalError('Protocol does not belong to this endpoint.')

        candidates = connectionP.intersection(connectionI)

        if candidates:
            if len(candidates) != 1:
                raise InternalError('There are more than one possible '
                                    'interface-protocol connections.')

            return candidates.pop()
        else:
            connection = InterfaceConnection(interface, protocol)
            connectionI.add(connection)
            connectionP.add(connection)
            return connection
dataset/ETHPy150Open rapyuta/rce/rce-core/rce/core/network.py/Endpoint.getInterfaceConnection