def clean_email_body(email_body):
    """Remove formating and URL's from an email's body

    Args:
        email_body (str, optional): The email's body

    Returns:
        str: The email's body without any formating or URL's
    """

    # If body is None, return an empty string
    if email_body is None: email_body = ""

    # Remove any HTML tags
    email_body = BeautifulSoup(email_body, "html.parser")
    email_body = email_body.get_text()

    # Remove return characters
    email_body = "".join(email_body.splitlines())

    # Remove extra spaces
    email_body = " ".join(email_body.split())

    # Remove unicode characters
    email_body = email_body.encode("ascii", "ignore")
    email_body = email_body.decode("utf-8", "ignore")

    # Remove any remaining URL's
    email_body = re.sub(r"http\S+", "", email_body)

    return email_body
Remove formating and URL's from an email's body

    Args:
        email_body (str, optional): The email's body

    Returns:
        str: The email's body without any formating or URL's
    
src/autogpt_plugins/email/email_plugin/email_plugin.py