code: def write(filepath, data, **kwargs):
      
      if filepath.lower().endswith('.csv'):
          return _write_csv(filepath, data, kwargs)
      elif filepath.lower().endswith('.json'):
          return _write_json(filepath, data, kwargs)
      elif filepath.lower().endswith('.jsonl'):
          return _write_jsonl(filepath, data, kwargs)
      elif filepath.lower().endswith('.pickle'):
          return _write_pickle(filepath, data, kwargs)
      elif (filepath.lower().endswith('.yml') or
            filepath.lower().endswith('.yaml')):
          raise NotImplementedError('YAML is not supported, because you need '
                                    'PyYAML in Python3. '
                                    'See '
                                    'https://stackoverflow.com/a/42054860/562769'
                                    ' as a guide how to use it.')
      elif (filepath.lower().endswith('.h5') or
            filepath.lower().endswith('.hdf5')):
          raise NotImplementedError('YAML is not supported. See '
                                    'https://stackoverflow.com/a/41586571/562769'
                                    ' as a guide how to use it.')
      else:
          raise NotImplementedError('File \'{}\' is not known.'.format(filepath))
docs: Write a file.
  
      Supported formats:
  
      * CSV
      * JSON, JSONL
      * pickle
  
      Parameters
      ----------
      filepath : str
          Path to the file that should be read. This methods action depends
          mainly on the file extension.
      data : dict or list
          Content that should be written
      kwargs : dict
          Any keywords for the specific file format.
  
      Returns
      -------
      data : str or bytes