def template_file(path=None, template_contents=None, template_source=None, context=None, **kwargs):
 if (template_contents is None):
  with open(template_source) as template_file:
   template_contents = template_file.read()
 if (context is None):
  context = {}
 file(path=path, contents=(template_contents % context), **kwargs)

def template_file ( path = None , template_contents = None , template_source = None , context = None , ** kwargs ) : if ( template_contents is None ) : with open ( template_source ) as template_file : template_contents = template_file . read ( ) if ( context is None ) : context = { } file ( path = path , contents = ( template_contents % context ) , ** kwargs )
require a file whose contents is defined by a template .