import jinja2


def __format_body(media, template):
    """
    This function loads the email body template and renders the contents using
    the dictionary passed to it.
    """
    loader = jinja2.FileSystemLoader(searchpath='templates')
    template_env = jinja2.Environment(loader=loader)
    template = template_env.get_template(template)

    return template.render(media=media)