code: def draw_dynamics(
      t,
      dyn,
      x_title=None,
      y_title=None,
      x_lim=None,
      y_lim=None,
      x_labels=True,
      y_labels=True,
      separate=False,
      axis=None,
  ):
      """!
      @brief Draw dynamic of each neuron (oscillator) in an oscillatory network.
      @details The function creates new `matplotlib` figure if `axis` is `None` and it should be closed when it is not needed.
  
      @param[in] t (list): Time points that corresponds to the dynamic (X-axis).
      @param[in] dyn (list): An output value of each oscillator (Y-axis).
      @param[in] x_title (string): Title for X-axis.
      @param[in] y_title (string): Title for Y-axis.
      @param[in] x_lim (double): X-limit.
      @param[in] y_lim (double): Y-limit.
      @param[in] x_labels (bool): If `True` then it shows X-labels.
      @param[in] y_labels (bool): If `True` then it shows Y-labels.
      @param[in] separate (list): Lists of oscillators that should be displayed on separate plots. If `None` then all oscillators are going to be displayed on the same plot. By default is `None`.
      @param[in] axis (ax): If specified then the axis will be used for drawing and plot will not be shown.
  
      @return (figure, Axis) Figure and axis where dynamic of each oscillator is presented. Figure is `None` if `axis`
                              value that is not `None` is provided to the fuction.
  
      """
  
      stage_xlim = None
      if x_lim is not None:
          stage_xlim = x_lim
      elif len(t) > 0:
          stage_xlim = [0, t[len(t) - 1]]
  
      if (isinstance(separate, bool) is True) and (separate is True):
          if isinstance(dyn[0], list) is True:
              number_lines = len(dyn[0])
          else:
              number_lines = 1
  
      elif isinstance(separate, list) is True:
          number_lines = len(separate)
  
      else:
          number_lines = 1
  
      dysplay_result = False
      figure = None
      if axis is None:
          dysplay_result = True
          figure, axis = plt.subplots(number_lines, 1)
  
      # Check if we have more than one dynamic
      if isinstance(dyn[0], list) is True:
          num_items = len(dyn[0])
          for index in range(0, num_items, 1):
              y = [item[index] for item in dyn]
  
              if number_lines > 1:
                  index_stage = -1
  
                  # Find required axes for the y
                  if isinstance(separate, bool) is True:
                      index_stage = index
  
                  elif isinstance(separate, list) is True:
                      for index_group in range(0, len(separate), 1):
                          if index in separate[index_group]:
                              index_stage = index_group
                              break
  
                  if index_stage != -1:
                      if index_stage != number_lines - 1:
                          axis[index_stage].get_xaxis().set_visible(
                              False
                          )
  
                      axis[index_stage].plot(t, y, "b-", linewidth=0.5)
                      set_ax_param(
                          axis[index_stage],
                          x_title,
                          y_title,
                          stage_xlim,
                          y_lim,
                          x_labels,
                          y_labels,
                          True,
                      )
  
              else:
                  axis.plot(t, y, "b-", linewidth=0.5)
                  set_ax_param(
                      axis,
                      x_title,
                      y_title,
                      stage_xlim,
                      y_lim,
                      x_labels,
                      y_labels,
                      True,
                  )
      else:
          axis.plot(t, dyn, "b-", linewidth=0.5)
          set_ax_param(
              axis,
              x_title,
              y_title,
              stage_xlim,
              y_lim,
              x_labels,
              y_labels,
              True,
          )
  
      if dysplay_result is True:
          plt.show()
  
      return figure, axis
  
imports: import time
  import numpy
  from numpy import array
  from PIL import Image
  import matplotlib.pyplot
  from sys import platform
  from pyclustering.utils.metric import distance_metric, type_metric
label_desc: Use image node_id 22 for calling a global function with example usage: draw_dynamics(t, dyn, x_title, y_title, x_lim, y_lim, x_labels, y_labels, separate, axis) and returns: figure,  axis