from typing import Tuple
from typing import Optional


def _match_bool(text: str) -> Tuple[str, Optional[bool]]:
    """Tries to match a boolean value.

    Args:
        text (str): The string containing the boolean value.

    Returns:
        Tuple[str, Optional[bool]]: A tuple containing the remaining text and boolean value if the
                                    match was successful, the original text and None otherwise.

    """
    if len(text) < 2 or text[0] != '#':
        return text, None
    if text[1] in 'tT':
        return text[2:], True
    if text[1] in 'fF':
        return text[2:], False
    return text, None