code: def _var_names(var_names, data):
      
      if var_names is not None:
  
          if isinstance(var_names, str):
              var_names = [var_names]
  
          if isinstance(data, (list, tuple)):
              all_vars = []
              for dataset in data:
                  dataset_vars = list(dataset.data_vars)
                  for var in dataset_vars:
                      if var not in all_vars:
                          all_vars.append(var)
          else:
              all_vars = list(data.data_vars)
  
          excluded_vars = [i[1:] for i in var_names if i.startswith("~") and i not in all_vars]
  
          all_vars_tilde = [i for i in all_vars if i.startswith("~")]
  
          if all_vars_tilde:
              warnings.warn(
                  """ArviZ treats '~' as a negation character for variable selection.
                     Your model has variables names starting with '~', {0}. Please double check
                     your results to ensure all variables are included""".format(
                      ", ".join(all_vars_tilde)
                  )
              )
  
          if excluded_vars:
              var_names = [i for i in all_vars if i not in excluded_vars]
  
      return var_names
docs: Handle var_names input across arviz.
  
      Parameters
      ----------
      var_names: str, list, or None
      data : xarray.Dataset
          Posterior data in an xarray
      Returns
      -------
      var_name: list or None