import re


def _remove_environment(text, environment):
  """Removes '\\begin{environment}*\\end{environment}' from 'text'."""
  return re.sub(
      r'\\begin\{' + environment + r'\}[\s\S]*?\\end\{' + environment + r'\}',
      '', text)