'Search for all ports that contain passed ip address and belongs to
given network.
If no network is passed ports are searched on all networks connected to
given router. Either one of network_id or router_id must be passed.'

def _get_ports(self, remote_address, network_id=None, router_id=None):

    if network_id:
        networks = (network_id,)
    elif router_id:
        networks = self._get_router_networks(router_id)
    else:
        raise TypeError(_('Either    one    of    parameter    network_id    or    router_id    must    be    passed    to    _get_ports    method.'))
    return self._get_ports_for_remote_address(remote_address, networks)
