code: def separate_output_values(Y, D, N, calc_second_order):
      AB = np.zeros((N, D))
      BA = np.zeros((N, D)) if calc_second_order else None
      step = 2 * D + 2 if calc_second_order else D + 2
  
      A = Y[0 : Y.size : step]
      B = Y[(step - 1) : Y.size : step]
      for j in range(D):
          AB[:, j] = Y[(j + 1) : Y.size : step]
          if calc_second_order:
              BA[:, j] = Y[(j + 1 + D) : Y.size : step]
  
      return A, B, AB, BA
  
imports: from types import MethodType
  from warnings import warn
  from scipy.stats import norm
  import numpy
  import pandas
  from .None import common_args
  from ..util import read_param_file, ResultDict, extract_group_names, _check_groups
  from multiprocessing import Pool, cpu_count
  from functools import partial
  from itertools import combinations, zip_longest
label_desc: Use image node_id 6 for calling a global function with example usage: separate_output_values(Y, D, N, calc_second_order) and returns: A,  B,  AB,  BA