def bit_to_flag(b_input, str_flags):
    """
    Analyze byte and select string chars depending on bits
    :param b_input: Byte to analyze
    :param str_flags: String with chars to use
    :return: String with chars according to bit state
    """
    str_result = ''
    for i in range(8):
        if b_input << i & 128:
            if str_flags[i] != ' ':
                str_result += str_flags[i]
    return str_result