from typing import Tuple
import re


def clean_pycon(source: str) -> Tuple[str, str]:
    """Clean up Python console syntax to pure Python."""
    in_statement = False
    source = re.sub(r'^\s*<BLANKLINE>', '', source, flags=re.MULTILINE)
    clean_lines = []
    for line in source.split('\n'):
        if line.startswith('>>> '):
            in_statement = True
            clean_lines.append(line[4:])
        elif in_statement and line.startswith('... '):
            clean_lines.append(line[4:])
        else:
            in_statement = False
            clean_lines.append('')
    return source, '\n'.join(clean_lines)