There is a task: to get only the html tags from the text.
<body class="body" style="color: red;">
The result should be
You also need to remove all attributes inside the tag. I wrote my solution, but it works for a long time. On one web page takes about 0.5 seconds. Maybe someone knows a ready built-in methods in bs4, selenium, or any other library?