code: def _squeeze_left(x, stop_at_dim: Optional[int] = None):
      """Squeeze any leading dims of `x` until a real dim or `stop_at_dim` (if not None) is reached."""
      x_dims = x.type.broadcastable
      squeeze_ndim = len(x_dims) if all(x_dims) else x_dims.index(False)
      if stop_at_dim is not None:
          squeeze_ndim = min(squeeze_ndim, stop_at_dim)
      if squeeze_ndim == 0:
          return x
      return x.squeeze(axis=tuple(range(squeeze_ndim)))
  
file_path: pytensor/pytensor/tensor/rewriting/blockwise.py
imports: from typing import Optional
  from pytensor.compile.mode import optdb
  from pytensor.graph import Constant, node_rewriter
  from pytensor.graph.replace import vectorize_node
  from pytensor.graph.rewriting.basic import copy_stack_trace, out2in
  from pytensor.tensor.basic import Alloc, ARange, alloc, shape_padleft
  from pytensor.tensor.blockwise import Blockwise
  from pytensor.tensor.math import Dot
  from pytensor.tensor.rewriting.basic import register_canonicalize, register_specialize, register_stabilize
  from pytensor.tensor.subtensor import AdvancedIncSubtensor, AdvancedSubtensor, Subtensor
label_desc: Use image node_id 4 for calling a global function with example usage: _squeeze_left(x, stop_at_dim) and returns: x, x