import logging


def get_video_bitrate(dict_inf, stream_video):
    """Bitrate search. It may be in one of the 2 possible places.

    Args:
        dict_inf (dict): video metadata
        stream_video (dict): video stream data

    Raises:
        NameError: If Bitrate is not found in any of the possible places

    Returns:
        int: video bitrate
    """

    try:
        video_bitrate = stream_video['bit_rate']
    except Exception as e:
        try:
            video_bitrate = dict_inf['format']['bit_rate']
        except Exception as e:
            print(f'{e}\n{dict_inf}')
            file = dict_inf['format']['filename']
            msg_err = "File bellow don't have 'bit_rate' in " + \
                        f'detail file:\n{file}'
            logging.error(msg_err)
            raise NameError(msg_err)

    return int(video_bitrate)