code: def _validate_offset(
      phenotype_df: pd.DataFrame, offset_df: pd.DataFrame
  ) -> _OffsetType:
      """
      Validates that the offset df matches the phenotype df. Returns the type of offset.
      """
      if not offset_df.empty:
          if not _have_same_elements(
              phenotype_df.columns, offset_df.columns
          ):
              raise ValueError(
                  f"phenotype_df and offset_df should have the same column names."
              )
          if offset_df.index.nlevels == 1:  # Indexed by sample id
              if not _have_same_elements(
                  phenotype_df.index, offset_df.index
              ):
                  raise ValueError(
                      f"phenotype_df and offset_df should have the same index."
                  )
              return _OffsetType.SINGLE_OFFSET
          elif (
              offset_df.index.nlevels == 2
          ):  # Indexed by sample id and contig
              all_contigs = _get_contigs_from_loco_df(offset_df)
              for contig in all_contigs:
                  offset_for_contig = offset_df.xs(contig, level=1)
                  if not _have_same_elements(
                      phenotype_df.index, offset_for_contig.index
                  ):
                      raise ValueError(
                          "When using a multi-indexed offset_df, the offsets for each contig "
                          "should have the same index as phenotype_df"
                      )
              return _OffsetType.LOCO_OFFSET
      else:
          return _OffsetType.NO_OFFSET
  
imports: from pyspark.sql import SparkSession, functions
  from pyspark.sql.types import StructField, StructType, FloatType, DoubleType, ArrayType
  from typing import Any, Callable, Dict, List, Optional, TypeVar, Union
  import numpy
  import pandas
  from nptyping import Float, NDArray
  from typeguard import typechecked
  import opt_einsum
  from glow.wgr.model_functions import _assert_all_present, _check_binary
  from glow.wgr.wgr_functions import _get_contigs_from_loco_df
  from enum import Enum
label_desc: Use image node_id 10 for calling a global function with example usage: _validate_offset(phenotype_df, offset_df) and returns: _OffsetType, _OffsetType, _OffsetType