code: def match_anywhere(subject: Expression, pattern: Pattern) -> Iterator[Tuple[Substitution, Tuple[int, ...]]]:
      
      if not is_constant(subject):
          raise ValueError("The subject for matching must be constant.")
      for child, pos in preorder_iter_with_position(subject):
          if match_head(child, pattern):
              for subst in match(child, pattern):
                  yield subst, pos
docs: Tries to match the given *pattern* to the any subexpression of the given *subject*.
  
      Yields each match in form of a substitution and a position tuple.
      The position is a tuple of indices, e.g. the empty tuple refers to the *subject* itself,
      :code:`(0, )` refers to the first child (operand) of the subject, :code:`(0, 0)` to the first child of
      the first child etc.
  
      Parameters:
          subject:
              An subject to match.
          pattern:
              The pattern to match.
  
      Yields:
          All possible substitution and position pairs.
  
      Raises:
          ValueError:
              If the subject is not constant.