import re


def _tracwiki_list_separate_from_paragraph(text: str):
    """
    During conversion from TracWiki to RST, ensure an empty line
    between each non-list-item and the list item following it, if any.
    """

    lines = text.split('\n')
    newlines = []
    was_list_item_or_blank = True

    for l in lines:
        is_list_item = re.match(r'^ *\* .*', l)
        if is_list_item:
            if not was_list_item_or_blank:
                newlines.append('')
            was_list_item_or_blank = True
        else:
            is_empty = l.strip() == ''
            was_list_item_or_blank = is_empty
        newlines.append(l)

    return '\n'.join(newlines)