code: def validate_order(dtype, order):
      if getattr(dtype, "fields", None) is None:
          if order is not None:
              raise ValueError(
                  "Cannot specify order when the array has no fields"
              )
          else:
              return
  
      need_check = True
      if order is None:
          order = list(dtype.names)
          need_check = False
      elif isinstance(order, (list, tuple)):
          order = list(order)
      else:
          order = [order]
      if need_check:
          for o in order:
              if o not in dtype.fields:
                  raise ValueError(f"unknown field name: {o}")
      return order
  
imports: import inspect
  import itertools
  import operator
  from collections import OrderedDict
  from collections.abc import Iterable
  from functools import lru_cache, reduce, wraps
  from math import ceil
  from numbers import Integral
  from typing import Dict, List, Union
  import numpy
  from ..core import ExecutableTuple, recursive_tile
  from ..utils import lazy_import
  from ..lib.mmh3 import hash_from_buffer
label_desc: Use image node_id 8 for calling a global function with example usage: validate_order(dtype, order) and returns: order