def loadf(path, encoding=None, model=None, parser=None):
    """Deserialize path (.arpa, .gz) to a Python object."""
    path = str(path)
    if path.endswith('.gz'):
        with gzip.open(path, mode='rt', encoding=encoding) as f:
            return load(f, model=model, parser=parser)
    else:
        with open(path, mode='rt', encoding=encoding) as f:
            return load(f, model=model, parser=parser)