<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_bs4_string(soup):
 """ Outputs a BeautifulSoup object as a string that should hopefully be minimally modified """

    if len(soup.find_all("script")) == 0:
        soup_str = soup.prettify(formatter=None).strip()
    else:
        soup_str = str(soup.html)
        soup_str = re.sub("&amp;", "&", soup_str)
        soup_str = re.sub("&lt;", "<", soup_str)
        soup_str = re.sub("&gt;", ">", soup_str)
    return soup_str