code: def dumpf(obj, path, encoding=None):
      
      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)
docs: Serialize obj to path in ARPA format (.arpa, .gz).