def convert_text_to_ssml(chunk):
    """Convert text to SSMl for Polly

    Args:
        chunk (str): chunk of text to parse

    Returns:
        str: Input test converted to SSML
    """
    # Escape chars that are forbidden in SSML
    chunk = chunk.replace('"', "&quot;").replace('&', "&amp;").replace("'", "&apos;").replace("<", "&lt;").replace(">", "&gt;")
    # <p></p> makes a longer pause happen between paragraphs
    chunk = chunk.replace("\r\n\r\n", "</p>\n<p>").replace("\n\n", "</p>\n<p>")
    chunk = "<speak><amazon:auto-breaths><p>" + chunk + "</p></amazon:auto-breaths></speak>"
    # Ensure no duplicate tags
    chunk = chunk.replace("</p></p>", "</p>").replace("</p>\n</p>", "</p>").replace("<p><p>", "<p>").replace("<p>\n<p>", "<p>")
    return chunk