'Get the number of in-flight requests for a node or all nodes.
Arguments:
node_id (int, optional): a specific node to check. If unspecified,
return the total for all nodes
Returns:
int: pending in-flight requests for the node, or all nodes if None'

def in_flight_request_count(self, node_id=None):

    if (node_id is not None):
        if (node_id not in self._conns):
            return 0
        return len(self._conns[node_id].in_flight_requests)
    else:
        return sum([len(conn.in_flight_requests) for conn in self._conns.values()])
