Return an instance of the language class that fname is suited for.

    Searches through the module langs for the class that matches up
    with fname.  If is_ext is True then fname will be taken to be
    the extension for a language.

def language(fname, is_ext=False):
    """Return an instance of the language class that fname is suited for.

    Searches through the module langs for the class that matches up
    with fname.  If is_ext is True then fname will be taken to be
    the extension for a language.

    """

    global _langmapping

    # Normalize the fname so that it looks like an extension.
    if is_ext:
        fname = '.' + fname
    _, ext = os.path.splitext(fname)

    return _langmapping[ext]()