Here's my reproduction using the Python Client Library. I used the pypi package "beautifulsoup4" to format the one-liner returned by the API to a pretty indented html format. The code is a slightly modified version of what you can find in this
Quickstart.
```
from bs4 import BeautifulSoup as bs # to format html text
def translate_text(target, text):
"""Translates text into the target language.
Target must be an ISO 639-1 language code.
"""
import six
from google.cloud import translate_v2 as translate
translate_client = translate.Client()
if isinstance(text, six.binary_type):
text = text.decode("utf-8")
# Text can also be a sequence of strings, in which case this method
# will return a sequence of results for each text.
result = translate_client.translate(text, target_language=target, format_="html") # note the I set the format_ to "html"
return result["translatedText"]
html_str = """
<p><a class="selfLink" id="notes" href="#notes" rel="help"><strong>Notes</strong></a>
<ul>
<li><a class="selfLink" id="disclaimer" href="#disclaimer" rel="help">DISCLAIMER OF LIABILITY</a>
"""
result = translate_text("es", html_str) # translate to Spanish
soup = bs(result)
print(soup.prettify())
```
Output:
```
<p>
<a class="selfLink" href="#notes" id="notes" rel="help">
<strong>
Notas
</strong>
</a>
<ul>
<li>
<a class="selfLink" href="#disclaimer" id="disclaimer" rel="help">
RENUNCIA DE RESPONSABILIDAD
</a>
</li>
</ul>
</p>
```
This is not exactly the input format but it's still great for reading.
I hope this was of help to you.
Kind regards,
Juan Carlos
-----