def build_stream_name():
    stream_name = last_stream_inf.get('NAME')
    if stream_name:
        return stream_name
    stream_group_id = last_stream_inf.get('VIDEO')
    if (not stream_group_id):
        return
    stream_group = groups.get(stream_group_id)
    if (not stream_group):
        return stream_group_id
    rendition = stream_group[0]
    return (rendition.get('NAME') or stream_group_id)
def build_stream_name():
    stream_name = last_stream_inf.get('NAME')
    if stream_name:
        return stream_name
    stream_group_id = last_stream_inf.get('VIDEO')
    if (not stream_group_id):
        return
    stream_group = groups.get(stream_group_id)
    if (not stream_group):
        return stream_group_id
    rendition = stream_group[0]
    return (rendition.get('NAME') or stream_group_id)