@hook.command('base64')
def base64_encode(text):
 return base64.b64encode(text.encode()).decode()

@ hook . command ( 'base64' ) def base64_encode ( text ) : return base64 . b64encode ( text . encode ( ) ) . decode ( )
base64 encodes a single bytestring .