code: def write_data(data, filename):
      
      name, ext = get_file_extension(filename)
      func = json_write_data if ext == '.json' else yaml_write_data
      return func(data, filename)
docs: Call right func to save data according to file extension