code: def _get_bs4_string(soup):
      
      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
docs: Outputs a BeautifulSoup object as a string that should hopefully be minimally modified