from typing import Pattern
import re


def tag_re(tag: str) -> Pattern:
    """ Return a regular expression to match tagged lines.

    Args:
        tag (str):
            A tag for which you need the regex pattern. This should be a single
            word.

    Returns:
        Pattern: Regex patter object as returned by `re.compile`.

    The returned pattern will match only the starting line that contains the
    tag. The item definition might span across multiple lines and this has to
    be handled separately
    """
    return re.compile(
        # r'\(feature\) (?P<text>.*?\n\n)',
        r'(- |\* |\s+)?{tag} (?P<text>.*)'.format(tag=re.escape(tag)),
    )