code: def check_align(align_df, name="align_df", index="iloc"):
      """Check whether the object is a data frame in alignment format.
  
      Parameters
      ----------
      align_df : any object
          check passes if it follows alignment format, as follows:
          pandas.DataFrame with column names 'ind'+str(i) for integers i, as follows
              all integers i between 0 and some natural number n must be present
      name : string, optional, default="align_df"
          variable name that is printed in ValueError-s
      index : string, optional, one of "iloc" (default), "loc", "either"
          whether alignment to check is "loc" or "iloc"
  
      Returns
      -------
      valid : boolean, whether align_df is a valid alignment data frame
      msg : error message if align_df is invalid
      """
      if not isinstance(align_df, pd.DataFrame):
          msg = f"{name} is not a pandas DataFrame"
          return False, msg
  
      cols = align_df.columns
      n = len(cols)
  
      correctcols = {f"ind{i}" for i in range(n)}
  
      if not set(cols) == set(correctcols):
          msg = f"{name} index columns must be named 'ind0', 'ind1', ... 'ind{n}'"
          return False, msg
  
      if index == "iloc":
          # checks whether df columns are of integer (numpy or pandas nullable) type
          dtypearr = np.array([str(x) for x in align_df[cols].dtypes])
          allowedtypes = np.array(
              [
                  "int",
                  "int8",
                  "int16",
                  "int32",
                  "int64",
                  "uint8",
                  "uint16",
                  "uint32",
                  "uint64",
                  "Int8",
                  "Int16",
                  "Int32",
                  "Int64",
                  "UInt8",
                  "UInt16",
                  "UInt32",
                  "UInt64",
              ]
          )
          if not np.all(np.isin(dtypearr, allowedtypes)):
              msg = f"columns of {name} must have dtype intX, uintX, IntX, or UIntX"
              return False, msg
      # no additional restrictions apply if loc or either, so no elif
  
      return True, ""
  
imports: import numpy
  import pandas
  from sktime.datatypes._common import _ret
label_desc: Use image node_id 1 for calling a global function with example usage: check_align(align_df, name, index) and returns: True,  str, False,  msg, False,  msg, False,  msg