Returns the appropriate template name based on the given file name.

def template_from_filename(filename):
    """Returns the appropriate template name based on the given file name."""
    ext = filename.split(os.path.extsep)[-1]
    if not ext in TEMPLATES_MAP:
        raise ValueError("No template for file extension {}".format(ext))
    return TEMPLATES_MAP[ext]