'Strips censored items from string
:param record: to censor'

def format(self, record):

    msg = super(CensoredFormatter, self).format(record)
    if (not isinstance(msg, six.text_type)):
        msg = msg.decode(self.encoding, u'replace')
    censored = {item for (_, item) in six.iteritems(censored_items) if item}
    censored = (censored | {quote(item) for item in censored})
    censored = list({(item.decode(self.encoding, u'replace') if (not isinstance(item, six.text_type)) else item) for item in censored})
    censored.sort(key=len, reverse=True)
    for item in censored:
        msg = msg.replace(item, (len(item) * u'*'))
    msg = re.sub(u'([&?]r|[&?]apikey|[&?]api_key)(?:=|%3D)[^&]*([&\\w]?)', u'\\1=**********\\2', msg, re.I)
    return msg
