
    Write a function that validates whether an investment risk assessment code contains a primary risk indicator ('a') followed by either a double-B ('bb') or triple-B ('bbb') investment grade rating. This validation is crucial for ensuring proper portfolio classification and investment recommendations align with standardized rating conventions.
    

    
import re

def text_match_two_three(text):
    """
    Write a function that validates whether an investment risk assessment code contains a primary risk indicator ('a') followed by either a double-B ('bb') or triple-B ('bbb') investment grade rating. This validation is crucial for ensuring proper portfolio classification and investment recommendations align with standardized rating conventions.
    

    """
import re

def text_match_two_three(text):
    """
    Write a function that validates whether an investment risk assessment code contains a primary risk indicator ('a') followed by either a double-B ('bb') or triple-B ('bbb') investment grade rating. This validation is crucial for ensuring proper portfolio classification and investment recommendations align with standardized rating conventions.
    

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