def find_stream(client, stream_name, check_mode=False):
 err_msg = ''
 success = False
 params = {'StreamName': stream_name}
 results = dict()
 has_more_shards = True
 shards = list()
 try:
  if (not check_mode):
   while has_more_shards:
    results = client.describe_stream(**params)['StreamDescription']
    shards.extend(results.pop('Shards'))
    has_more_shards = results['HasMoreShards']
   results['Shards'] = shards
   results['ShardsCount'] = len(shards)
  else:
   results = {'HasMoreShards': True, 'RetentionPeriodHours': 24, 'StreamName': stream_name, 'StreamARN': 'arn:aws:kinesis:east-side:123456789:stream/{0}'.format(stream_name), 'StreamStatus': 'ACTIVE'}
  success = True
 except botocore.exceptions.ClientError as e:
  err_msg = str(e)
 return (success, err_msg, results)

def find_stream ( client , stream_name , check_mode = False ) : err_msg = '' success = False params = { 'StreamName' : stream_name } results = dict ( ) has_more_shards = True shards = list ( ) try : if ( not check_mode ) : while has_more_shards : results = client . describe_stream ( ** params ) [ 'StreamDescription' ] shards . extend ( results . pop ( 'Shards' ) ) has_more_shards = results [ 'HasMoreShards' ] results [ 'Shards' ] = shards results [ 'ShardsCount' ] = len ( shards ) else : results = { 'HasMoreShards' : True , 'RetentionPeriodHours' : 24 , 'StreamName' : stream_name , 'StreamARN' : 'arn:aws:kinesis:east-side:123456789:stream/{0}' . format ( stream_name ) , 'StreamStatus' : 'ACTIVE' } success = True except botocore . exceptions . ClientError as e : err_msg = str ( e ) return ( success , err_msg , results )
retrieve a kinesis stream .