code: def template_from_filename(filename):
      
      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]
docs: Returns the appropriate template name based on the given file name.