from typing import Any
import pickle


def read_pickled(filepath: str, encoding: str = "latin1") -> Any:
  """Read the pickled data in the file

    Args:
      filepath (str): The file path
      encoding (str): File encoding. Defaults to :data:`"latin1"`

    Returns:
      The unpickled data"""
  with open(filepath, "rb") as f:
    return pickle.load(f, encoding=encoding)