code: def expand(
      x: np.ndarray,
      shape: Union[List[int], List[Tuple]],
      /,
      *,
      copy: Optional[bool] = None,
      out: Optional[np.ndarray] = None,
  ) -> np.ndarray:
      shape = list(shape)
      n_extra_dims = len(shape) - x.ndim
      if n_extra_dims > 0:
          x = np.expand_dims(x, tuple(range(n_extra_dims)))
      for i, dim in enumerate(shape):
          if dim < 0:
              shape[i] = x.shape[i]
      return np.broadcast_to(x, tuple(shape))
  
imports: from typing import Iterable, Optional, Union, Sequence, Tuple, NamedTuple, Literal, Callable, Any, List
  from numbers import Number
  from collections import namedtuple
  import numpy
  import ivy
  from ivy.functional.backends.numpy.helpers import _scalar_output_to_0d_array
  from ivy.func_wrapper import with_supported_dtypes
  from .None import backend_version
label_desc: Use image node_id 23 for calling a global function with example usage: expand() and returns: np