
    Write a function that analyzes bus occupancy patterns by detecting when a bus arrival ('a') is followed by either a medium load state (two 'b's) or maximum load state (three 'b's) in the transit monitoring sequence. The function should help transit authorities identify specific capacity threshold patterns to optimize bus scheduling and prevent overcrowding.
    

    
import re

def text_match_two_three(text):
    """
    Write a function that analyzes bus occupancy patterns by detecting when a bus arrival ('a') is followed by either a medium load state (two 'b's) or maximum load state (three 'b's) in the transit monitoring sequence. The function should help transit authorities identify specific capacity threshold patterns to optimize bus scheduling and prevent overcrowding.
    

    """
import re

def text_match_two_three(text):
    """
    Write a function that analyzes bus occupancy patterns by detecting when a bus arrival ('a') is followed by either a medium load state (two 'b's) or maximum load state (three 'b's) in the transit monitoring sequence. The function should help transit authorities identify specific capacity threshold patterns to optimize bus scheduling and prevent overcrowding.
    

    """
    patterns = 'ab{2,3}'
    if re.search(patterns, text):
        return True
    else:
        return False