Serialize obj to path in ARPA format (.arpa, .gz).

def dumpf(obj, path, encoding=None):
    """Serialize obj to path in ARPA format (.arpa, .gz)."""
    path = str(path)
    if path.endswith('.gz'):
        with gzip.open(path, mode='wt', encoding=encoding) as f:
            return dump(obj, f)
    else:
        with open(path, mode='wt', encoding=encoding) as f:
            dump(obj, f)