code: def get_covariates(covariates: dict) -> Covariates:
      """
      Obtain the main, group, and panel covariates from the user's
      conditional dict.
      """
      covariate_kinds = ("main", "group", "panel")
      if any(key in covariate_kinds for key in covariates.keys()):
          # default if user did not pass their own conditional dict
          main = covariates.get("main")
          group = covariates.get("group", None)
          panel = covariates.get("panel", None)
      else:
          # assign main, group, panel based on the number of variables
          # passed by the user in their conditional dict
          length = len(covariates.keys())
          if length == 1:
              main = covariates.keys()
              group = None
              panel = None
          elif length == 2:
              main, group = covariates.keys()
              panel = None
          elif length == 3:
              main, group, panel = covariates.keys()
  
      return Covariates(main, group, panel)
  
imports: from dataclasses import dataclass, field
  from typing import Union
  import numpy
  from formulae.terms.call import Call
  import pandas
  import xarray
  from bambi import Model
  from bambi.utils import listify
  from bambi.interpret.logs import log_interpret_defaults
label_desc: Use image node_id 4 for calling a global function with example usage: get_covariates(covariates) and returns: Covariates