def str_encode(value, encoder='base64'):
 try:
  out = value.encode(encoder)
 except LookupError:
  raise SaltInvocationError('You must specify a valid encoder')
 except AttributeError:
  raise SaltInvocationError('Value must be an encode-able string')
 return out

def str_encode ( value , encoder = 'base64' ) : try : out = value . encode ( encoder ) except LookupError : raise SaltInvocationError ( 'You must specify a valid encoder' ) except AttributeError : raise SaltInvocationError ( 'Value must be an encode-able string' ) return out
encode character string in the series/index using indicated encoding .