
    Write a function that analyzes a patient's medication adherence pattern to determine if they have taken their prescribed initial dose followed by the correct number of maintenance doses, where the initial dose must be followed by either two or three consecutive maintenance doses to be considered compliant. The adherence pattern is represented as a string where 'a' indicates the initial prescribed dose and 'b' represents each maintenance dose taken.
    

    
import re

def text_match_two_three(text):
    """
    Write a function that analyzes a patient's medication adherence pattern to determine if they have taken their prescribed initial dose followed by the correct number of maintenance doses, where the initial dose must be followed by either two or three consecutive maintenance doses to be considered compliant. The adherence pattern is represented as a string where 'a' indicates the initial prescribed dose and 'b' represents each maintenance dose taken.
    

    """
import re

def text_match_two_three(text):
    """
    Write a function that analyzes a patient's medication adherence pattern to determine if they have taken their prescribed initial dose followed by the correct number of maintenance doses, where the initial dose must be followed by either two or three consecutive maintenance doses to be considered compliant. The adherence pattern is represented as a string where 'a' indicates the initial prescribed dose and 'b' represents each maintenance dose taken.
    

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