def _make_stream_transport(self):
    """Create an AdbStreamTransport with a newly allocated local_id."""
    msg_queue = queue.Queue()
    with self._stream_transport_map_lock:
      # Start one past the last id we used, and grab the first available one.
      # This mimics the ADB behavior of 'increment an unsigned and let it
      # overflow', but with a check to ensure we don't reuse an id in use,
      # even though that's unlikely with 2^32 - 1 of them available.  We try
      # at most 64 id's, if we've wrapped around and there isn't one available
      # in the first 64, there's a problem, better to fail fast than hang for
      # a potentially very long time (STREAM_ID_LIMIT can be very large).
      self._last_id_used = (self._last_id_used % STREAM_ID_LIMIT) + 1
      for local_id in itertools.islice(
          itertools.chain(
              range(self._last_id_used, STREAM_ID_LIMIT),
              range(1, self._last_id_used)), 64):
        if local_id not in list(self._stream_transport_map.keys()):
          self._last_id_used = local_id
          break
      else:
        raise usb_exceptions.AdbStreamUnavailableError('Ran out of local ids!')
      # Ignore this warning - the for loop will always have at least one
      # iteration, so local_id will always be set.
      # pylint: disable=undefined-loop-variable
      stream_transport = AdbStreamTransport(self, local_id, msg_queue)
      self._stream_transport_map[local_id] = stream_transport
    return stream_transport
Create an AdbStreamTransport with a newly allocated local_id.