from typing import Tuple
from bs4 import BeautifulSoup


def pre_process_iframes_from_html(raw_content: str) -> Tuple[str, dict]:
    """Locate, and replace iframes with placeholder ID

    Parameters
    ----------
    raw_content : str
        A string of HTML code to be parsed for iframe tags.

    Returns
    -------
    processed_content: str
        The raw_content with iframe code replaced with a unique placeholder string
    iframes_dict: dict
        Dictionary where the key is the unique placeholder string, the value is the iframe beautiful soup tag object

    """
    soup = BeautifulSoup(raw_content, 'html.parser')

    iframes = soup.select('iframe')
    iframes_dict = {}
    for iframe in iframes:
        placeholder_text = f'iframe-placeholder-id-{str(id(iframe))}'
        iframes_dict[placeholder_text] = iframe
        iframe.replace_with(f'{placeholder_text}')

    processed_content = str(soup)

    return processed_content, iframes_dict