code: def get_xml(html, content_tag='ekb', fail_if_empty=False):
      
      cont = re.findall(r'<%(tag)s(.*?)>(.*?)</%(tag)s>' % {'tag': content_tag},
                        html, re.MULTILINE | re.DOTALL)
      if cont:
          events_terms = ''.join([l.strip() for l in cont[0][1].splitlines()])
          if 'xmlns' in cont[0][0]:
              meta = ' '.join([l.strip() for l in cont[0][0].splitlines()])
          else:
              meta = ''
      else:
          events_terms = ''
          meta = ''
  
      if fail_if_empty:
          assert events_terms != '',\
              "Got empty string for events content from html:\n%s" % html
  
      header = ('<?xml version="1.0" encoding="utf-8" standalone="yes"?><%s%s>'
                % (content_tag, meta))
      footer = '</%s>' % content_tag
      return header + events_terms.replace('\n', '') + footer
docs: Extract the content XML from the HTML output of the TRIPS web service.
  
      Parameters
      ----------
      html : str
          The HTML output from the TRIPS web service.
      content_tag : str
          The xml tag used to label the content. Default is 'ekb'.
      fail_if_empty : bool
          If True, and if the xml content found is an empty string, raise an
          exception. Default is False.
  
      Returns
      -------
      The extraction knowledge base (e.g. EKB) XML that contains the event and
      term extractions.