def make_temp(string, suffix='', decode=True, delete=True):
 ntf = NamedTemporaryFile(suffix=suffix, delete=delete)
 if decode:
  ntf.write(base64.b64decode(string))
 else:
  ntf.write(string)
 ntf.seek(0)
 return (ntf, ntf.name)

def make_temp ( string , suffix = '' , decode = True , delete = True ) : ntf = NamedTemporaryFile ( suffix = suffix , delete = delete ) if decode : ntf . write ( base64 . b64decode ( string ) ) else : ntf . write ( string ) ntf . seek ( 0 ) return ( ntf , ntf . name )
xmlsec needs files in some cases where only strings exist .