Makes a template class preferred for the given file extensions. If you
        don't provide any extensions, it will be preferred for all its already
        registered extensions:
      
        # Prefer Markdown for its registered file extensions:
        Lean.prefer(MarkdownTemplate)
        
        # Prefer Markdown only for the .md elxtensions:
        Lean.prefer(MarkdownTemplate, '.md')

def prefer(template_class,*extensions):
    ''' Makes a template class preferred for the given file extensions. If you
        don't provide any extensions, it will be preferred for all its already
        registered extensions:
      
        # Prefer Markdown for its registered file extensions:
        Lean.prefer(MarkdownTemplate)
        
        # Prefer Markdown only for the .md elxtensions:
        Lean.prefer(MarkdownTemplate, '.md')
    '''

    if len(extensions):
      for (ext,klasses) in Lean.template_mappings.items():
        if klasses.count(template_class):
          Lean.preferred_mappings[ext] = template_class
    else:
      for ext in extensions:
        ext = normalize(ext)
        Lean.register(template_class,ext)
        Lean.preferred_mappings[ext] = template_class