import re


def _clean_tags(text):  # pylint: disable=R0915
    """ Clean known tags from the text.
    """
    text = text.replace('[center]', '')
    text = text.replace('[/center]', '')
    text = text.replace('[right]', '')
    text = text.replace('[/right]', '')
    text = text.replace('[b]', '')
    text = text.replace('[/b]', '')
    text = text.replace('[i]', '')
    text = text.replace('[/i]', '')
    text = text.replace('[bi]', '')
    text = text.replace('[/bi]', '')
    text = text.replace('[u]', '')
    text = text.replace('[/u]', '')
    text = text.replace('[strike]', '')
    text = text.replace('[/strike]', '')
    text = text.replace('[red]', '')
    text = text.replace('[/red]', '')
    text = text.replace('[space]', '')
    text = text.replace('[vspace]', '')
    text = text.replace('[tab]', '')
    text = text.replace('[nobr]', '')
    text = text.replace('[inline]', '')
    text = text.replace('[lsb]', '')
    text = text.replace('[rsb]', '')
    text = text.replace('[lfb]', '')
    text = text.replace('[rfb]', '')

    text = re.sub(r'\[lotr [^\]]+\]', '', text)
    text = re.sub(r'\[lotrheader [^\]]+\]', '', text)
    text = re.sub(r'\[size [^\]]+\]', '', text)
    text = re.sub(r'\[defaultsize [^\]]+\]', '', text)
    text = re.sub(r'\[img [^\]]+\]', '', text)

    text = text.replace('[/lotr]', '')
    text = text.replace('[/lotrheader]', '')
    text = text.replace('[/size]', '')

    text = text.replace('[unique]', '')
    text = text.replace('[threat]', '')
    text = text.replace('[attack]', '')
    text = text.replace('[defense]', '')
    text = text.replace('[willpower]', '')
    text = text.replace('[leadership]', '')
    text = text.replace('[lore]', '')
    text = text.replace('[spirit]', '')
    text = text.replace('[tactics]', '')
    text = text.replace('[baggins]', '')
    text = text.replace('[fellowship]', '')
    text = text.replace('[sunny]', '')
    text = text.replace('[cloudy]', '')
    text = text.replace('[rainy]', '')
    text = text.replace('[stormy]', '')
    text = text.replace('[sailing]', '')
    text = text.replace('[eos]', '')
    text = text.replace('[pp]', '')

    text = text.replace('[unmatched quot]', '')
    return text