Get complete stream info from AWS, returning only when the stream is in the ACTIVE state.
    Continues to retry when stream is updating or creating.
    If the stream is deleted during retries, the loop will catch the error and break.

    CLI example::

        salt myminion boto_kinesis.get_stream_when_active my_stream region=us-east-1

def get_stream_when_active(stream_name, region=None, key=None, keyid=None, profile=None):
    '''
    Get complete stream info from AWS, returning only when the stream is in the ACTIVE state.
    Continues to retry when stream is updating or creating.
    If the stream is deleted during retries, the loop will catch the error and break.

    CLI example::

        salt myminion boto_kinesis.get_stream_when_active my_stream region=us-east-1
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    stream_status = None
    # only get basic stream until it's active,
    # so we don't pull the full list of shards repeatedly (in case of very large stream)
    attempt = 0
    max_retry_delay = 10
    while stream_status != "ACTIVE":
        time.sleep(_jittered_backoff(attempt, max_retry_delay))
        attempt += 1
        stream_response = _get_basic_stream(stream_name, conn)
        if 'error' in stream_response:
            return stream_response
        stream_status = stream_response['result']["StreamDescription"]["StreamStatus"]

    # now it's active, get the full stream if necessary
    if stream_response['result']["StreamDescription"]["HasMoreShards"]:
        stream_response = _get_full_stream(stream_name, region, key, keyid, profile)

    return stream_response