def match_single_pragma(code):
    """
    Given a block of code starting at a pragma, return the pragma up to its
    closing curly brace.
    """
    curly_count = 0
    for i, char in enumerate(code):
        if char == '{':
            curly_count += 1
        elif char == '}':
            curly_count -= 1
            if i > 0 and curly_count == 0:
                return code[:i + 1]
