code: def shape_from_pyval(pyval, layout: Sequence[int] | None = None):
      """Returns a Shape that describes a tuple-tree of Numpy arrays."""
  
      def convert(pyval):
          if isinstance(pyval, tuple):
              if layout is not None:
                  raise NotImplementedError(
                      "shape_from_pyval does not support layouts for tuple shapes"
                  )
              return Shape.tuple_shape(
                  tuple(convert(elt) for elt in pyval)
              )
          else:
              return Shape.array_shape(
                  pyval.dtype, np.shape(pyval), layout
              )
  
      return convert(pyval)
  
imports: from __future__ import annotations
  import atexit
  import contextlib
  import enum
  import gzip
  import inspect
  import logging
  import os
  import threading
  from typing import Any, List, Mapping, Optional, Sequence, Tuple, Union
  import ml_dtypes
  import numpy
  from .None import xla_extension
label_desc: Use image node_id 14 for calling a global function with example usage: shape_from_pyval(pyval, layout) and returns: convert, Shape, Shape