input: Write a python function to convert plaintext to HTML, preserving specific text styles.
  assert plaintext2html('This is a test.\n') == '<html>\n<head>\n\n</head>\n<body>\nThis&nbsp;is&nbsp;a&nbsp;test.<br>\n</body>\n</html>\n'
  assert plaintext2html('Bold \033[1mtext\033[22m.') == '<html>\n<head>\n\n</head>\n<body>\nBold <span style="font-weight:bold">text</span>.\n</body>\n</html>\n'
  assert plaintext2html('Underline \033[1;4mtext\033[0;0m.') == '<html>\n<head>\n\n</head>\n<body>\nUnderline <span style="text-decoration: underline">text</span>.\n</body>\n</html>\n'
output: def plaintext2html(text):
      import re
      text = text.replace(' ', '&nbsp;').replace('\n', '<br>')
      
      bold_pattern = re.compile(r'\033\[1m(.*?)\033\[22m')
      text = bold_pattern.sub(r'<span style="font-weight:bold">\1</span>', text)
      
      underline_pattern = re.compile(r'\033\[1;4m(.*?)\033\[0;0m')
      text = underline_pattern.sub(r'<span style="text-decoration: underline">\1</span>', text)
      
      return f'<html>\n<head>\n\n</head>\n<body>\n{text}\n</body>\n</html>\n'