'Cleanse, HTML encode, and return attribute value text.'

def attval(self, text, whitespace=re.compile('[\n\r DCTB \x0b\x0c]')):

    encoded = self.encode(whitespace.sub('    ', text))
    if (self.in_mailto and self.settings.cloak_email_addresses):
        encoded = encoded.replace('%40', '&#37;&#52;&#48;')
        encoded = encoded.replace('.', '&#46;')
    return encoded
