def METHOD_NAME(data: np.ndarray, title: Optional[str] = None, legend: List[str] = None, ylabel: str = None, fontsize=16, titlefontsize=24,
              before_fn: Optional[Callable[[plt.Figure, np.ndarray], None]] = None,
              after_fn: Optional[Callable[[plt.Figure, np.ndarray], None]] = None) -> plt.Figure:
  fig = plt.figure()
  if before_fn is not None:
      before_fn(fig, data)
  plt.plot(data)
  if legend is not None:
    plt.legend(legend, fontsize=fontsize)
  if ylabel is not None:
    plt.ylabel(ylabel, fontsize=fontsize)
  plt.xlabel('Iterations', fontsize=fontsize)
  plt.grid()
  if title is not None:
    plt.title(title, fontsize=titlefontsize)
  if after_fn is not None:
      after_fn(fig, data)
  return fig