Generates file based on jinja2 templates

def put_skeleton_files_on_disk(metadata_type, where, github_template=None, params={}):
    """
        Generates file based on jinja2 templates
    """
    api_name = params["api_name"]
    file_name = github_template["file_name"]
    template_source = config.connection.get_plugin_client_setting('mm_template_source', 'joeferraro/MavensMate-Templates/master')
    template_location = config.connection.get_plugin_client_setting('mm_template_location', 'remote')

    try:
        if template_location == 'remote':
            if 'linux' in sys.platform:
                template_body = os.popen("wget https://raw.githubusercontent.com/{0}/{1}/{2} -q -O -".format(template_source, metadata_type, file_name)).read()
            else:
                template_body = urllib2.urlopen("https://raw.githubusercontent.com/{0}/{1}/{2}".format(template_source, metadata_type, file_name)).read()
        else:
            template_body = get_file_as_string(os.path.join(template_source,metadata_type,file_name))
    except:
        template_body = get_file_as_string(os.path.join(config.base_path,config.support_dir,"templates","github-local",metadata_type,file_name))

    template = env.from_string(template_body)
    file_body = template.render(params)
    metadata_type = get_meta_type_by_name(metadata_type)
    os.makedirs("{0}/{1}".format(where, metadata_type['directoryName']))
    f = open("{0}/{1}/{2}".format(where, metadata_type['directoryName'], api_name+"."+metadata_type['suffix']), 'w')
    f.write(file_body)
    f.close()

    template = env.get_template('meta.html')
    file_body = template.render(api_name=api_name, sfdc_api_version=SFDC_API_VERSION,meta_type=metadata_type['xmlName'])
    f = open("{0}/{1}/{2}".format(where, metadata_type['directoryName'], api_name+"."+metadata_type['suffix'])+"-meta.xml", 'w')
    f.write(file_body)
    f.close()