from typing import Tuple
import re


def _maybe_override_deck(
    content: str, deck: str
) -> Tuple[str, str]:
    """ Given a content of the card and a default deck, check if 
    there is a !deck directive in the card body
    that would override the parent deck.
    Removes the directive from the body.
    """

    override_pattern = re.compile(r'!deck: (.+)')
    override = re.search(override_pattern, content)

    if override is not None:
        deck = override.group(1)
        content = re.sub(override_pattern, '', content)

    return content, deck