'Retrieves the actual tracing details from Cassandra and populates the
attributes of this instance.  Because tracing details are stored
asynchronously by Cassandra, this may need to retry the session
detail fetch.  If the trace is still not available after `max_wait`
seconds, :exc:`.TraceUnavailable` will be raised; if `max_wait` is
:const:`None`, this will retry forever.
`wait_for_complete=False` bypasses the wait for duration to be populated.
This can be used to query events from partial sessions.
`query_cl` specifies a consistency level to use for polling the trace tables,
if it should be different than the session default.'

def populate(self, max_wait=2.0, wait_for_complete=True, query_cl=None):

    attempt = 0
    start = time.time()
    while True:
        time_spent = (time.time() - start)
        if ((max_wait is not None) and (time_spent >= max_wait)):
            raise TraceUnavailable(('Trace    information    was    not    available    within    %f    seconds.    Consider    raising    Session.max_trace_wait.' % (max_wait,)))
        log.debug('Attempting    to    fetch    trace    info    for    trace    ID:    %s', self.trace_id)
        session_results = self._execute(SimpleStatement(self._SELECT_SESSIONS_FORMAT, consistency_level=query_cl), (self.trace_id,), time_spent, max_wait)
        is_complete = (session_results and (session_results[0].duration is not None) and (session_results[0].started_at is not None))
        if ((not session_results) or (wait_for_complete and (not is_complete))):
            time.sleep((self._BASE_RETRY_SLEEP * (2 ** attempt)))
            attempt += 1
            continue
        if is_complete:
            log.debug('Fetched    trace    info    for    trace    ID:    %s', self.trace_id)
        else:
            log.debug('Fetching    parital    trace    info    for    trace    ID:    %s', self.trace_id)
        session_row = session_results[0]
        self.request_type = session_row.request
        self.duration = (timedelta(microseconds=session_row.duration) if is_complete else None)
        self.started_at = session_row.started_at
        self.coordinator = session_row.coordinator
        self.parameters = session_row.parameters
        self.client = getattr(session_row, 'client', None)
        log.debug('Attempting    to    fetch    trace    events    for    trace    ID:    %s', self.trace_id)
        time_spent = (time.time() - start)
        event_results = self._execute(SimpleStatement(self._SELECT_EVENTS_FORMAT, consistency_level=query_cl), (self.trace_id,), time_spent, max_wait)
        log.debug('Fetched    trace    events    for    trace    ID:    %s', self.trace_id)
        self.events = tuple((TraceEvent(r.activity, r.event_id, r.source, r.source_elapsed, r.thread) for r in event_results))
        break
