code: def get_kwargs(grid, kwargs, phenotypes=False):
      
      denom = None
      if "denom" in kwargs:
          denom = kwargs["denom"]
  
      if "palette" in kwargs:
          palette = kwargs["palette"]
          if denom is None:
              denom = len(palette)
      elif "environment" in kwargs or isinstance(grid, EnvironmentFile):
          if "environment" in kwargs:
              env = kwargs["environment"]
          else:
              env = grid
  
          if phenotypes:
              palette = env.task_palette
              if denom is None:
                  denom = len(env.tasks)
          else:
              palette = env.resource_palette
              if denom is None:
                  denom = len(env.resources)
  
      else:
          length = get_pallete_length(grid)
          palette = sns.hls_palette(length, s=1)
          denom = length
  
      return denom, palette
docs: Helper function to figure out what denom and palette to use, based on the
      kwargs and the grid being plotted. The optional (default: false) argument
      indicates whether the grid contains phenotypes, as opposed to resources.