import json
import zlib


def open_file(dataset_path):
  """
  Open a JSON dataset in the dataset path

  Args :
    - dataset_path (str) :  the dataset path

  Returns :
    - dict : the loaded dataset
  """
  try :
    with open(dataset_path, 'r') as file:
      return json.load(file)
  except UnicodeDecodeError:
    with open(dataset_path, 'rb') as file:
      read_file = file.read()
      return json.loads(zlib.decompress(read_file), encoding='utf-8')