'Flask documentation contains \'Â¶\' symbol to represent hyperlinks
which needs to be removed. Double spaces needs to be
converted to single spaces. HTML symbol xbb causes problems in
postgres, needs to be escaped.'

def clean_formatting(self, text):

    text = text.replace('        ', '    ').replace('\n', '\\n').replace('\xc3\x82\xc2\xb6', '').replace('\\xbb', '\\\\xbb').strip()
    return text
