code: def insert_mode(page_html, mode):
      ''' Insert mode '''
      page_html = page_html.decode("utf-8")
      match_found = False
      matches = re.finditer('workerId={{ workerid }}', page_html)
      match = None
      for match in matches:
          match_found = True
      if match_found:
          new_html = page_html[:match.end()] + "&mode=" + mode +\
              page_html[match.end():]
          return new_html
      else:
          raise ExperimentError("insert_mode_failed"f insert_mode(page_html, mode):
      ''' Insert mode '''
      page_html = page_html.decode("utf-8")
      match_found = False
      matches = re.finditer('workerId={{ workerid }}', page_html)
      match = None
      for match in matches:
          match_found = True
      if match_found:
          new_html = page_html[:match.end()] + "&mode=" + mode +\
              page_html[match.end():]
          return new_html
      else:
          raise ExperimentError("insert_mode_failed")
docs: Insert mode