from typing import Optional
from typing import Dict


def _create_rich_text_object(content: str, url: Optional[str] = None) -> Dict:
    """
    Create a Notion rich text object with the given text contents,
    and optionally a link to the given url
    (https://developers.notion.com/reference/rich-text)
    """
    rto = {"type": "text", "text": {"content": content}}
    if url:
        rto['link'] = {'type': 'url', 'url': url}
    return rto