Convert markup to string before passing to BS4