def enc(data, **kwargs):
 key = _get_key(**kwargs)
 sk = base64.b64decode(key)
 b = libnacl.secret.SecretBox(sk)
 return base64.b64encode(b.encrypt(data))

def enc ( data , ** kwargs ) : key = _get_key ( ** kwargs ) sk = base64 . b64decode ( key ) b = libnacl . secret . SecretBox ( sk ) return base64 . b64encode ( b . encrypt ( data ) )
encodes a string for sgml/xml/html .