code: def dump(obj, fp):
      '''Serialize an object representing the ARFF document to a given file-like
      object.
  
      :param obj: a dictionary.
      :param fp: a file-like object.
      '''
      encoder = ArffEncoder()
      generator = encoder.iter_encode(obj)
  
      last_row = next(generator)
      for row in generator:
          fp.write(last_row + u'\n')
          last_row = row
      fp.write(last_row)
  
      return ff dump(obj, fp):
      '''Serialize an object representing the ARFF document to a given file-like
      object.
  
      :param obj: a dictionary.
      :param fp: a file-like object.
      '''
      encoder = ArffEncoder()
      generator = encoder.iter_encode(obj)
  
      last_row = next(generator)
      for row in generator:
          fp.write(last_row + u'\n')
          last_row = row
      fp.write(last_row)
  
      return fp
docs: Serialize an object representing the ARFF document to a given file-like
      object.
  
      :param obj: a dictionary.
      :param fp: a file-like object.