code: def _flatten(x):
      """Iterate recursively through an arbitrarily nested structure in depth-first order.
  
      See also :func:`_unflatten`.
  
      Args:
          x (array, Iterable, Any): each element of an array or an Iterable may itself be any of these types
  
      Yields:
          Any: elements of x in depth-first order
      """
      if isinstance(x, np.ndarray):
          yield from _flatten(
              x.flat
          )  # should we allow object arrays? or just "yield from x.flat"?
      elif isinstance(x, qml.wires.Wires):
          # Reursive calls to flatten `Wires` will cause infinite recursion (`Wires` atoms are `Wires`).
          # Since Wires are always flat, just yield.
          for item in x:
              yield item
      elif isinstance(x, Iterable) and not isinstance(x, (str, bytes)):
          for item in x:
              yield from _flatten(item)
      else:
          yield x
  
file_path: pennylane/pennylane/utils.py
imports: from collections.abc import Iterable
  import functools
  import inspect
  import numbers
  import numpy
  import pennylane
label_desc: Use image node_id 1 for calling a global function with example usage: _flatten(x) without return types