code: def extract_substitution(self, subject: 'expressions.Expression', pattern: 'expressions.Expression') -> bool:
          
          if getattr(pattern, 'variable_name', False):
              try:
                  self.try_add_variable(pattern.variable_name, subject)
              except ValueError:
                  return False
              return True
          elif isinstance(pattern, expressions.Operation):
              assert isinstance(subject, type(pattern))
              assert op_len(subject) == op_len(pattern)
              op_expression = cast(expressions.Operation, subject)
              for subj, patt in zip(op_iter(op_expression), op_iter(pattern)):
                  if not self.extract_substitution(subj, patt):
                      return False
          return True
docs: Extract the variable substitution for the given pattern and subject.
  
          This assumes that subject and pattern already match when being considered as linear.
          Also, they both must be :term:`syntactic`, as sequence variables cannot be handled here.
          All that this method does is checking whether all the substitutions for the variables can be unified.
          So, in case it returns ``False``, the substitution is invalid for the match.
  
          ..warning::
  
              This method mutates the substitution and will even do so in case the extraction fails.
  
              Create a copy before using this method if you need to preserve the original substitution.
  
          Example:
  
              With an empty initial substitution and a linear pattern, the extraction will always succeed:
  
              >>> subst = Substitution()
              >>> subst.extract_substitution(f(a, b), f(x_, y_))
              True
              >>> print(subst)
              {x ↦ a, y ↦ b}
  
              Clashing values for existing variables will fail:
  
              >>> subst.extract_substitution(b, x_)
              False
  
              For non-linear patterns, the extraction can also fail with an empty substitution:
  
              >>> subst = Substitution()
              >>> subst.extract_substitution(f(a, b), f(x_, x_))
              False
              >>> print(subst)
              {x ↦ a}
  
              Note that the initial substitution got mutated even though the extraction failed!
  
          Args:
              subject:
                  A :term:`syntactic` subject that matches the pattern.
              pattern:
                  A :term:`syntactic` pattern that matches the subject.
  
          Returns:
              ``True`` iff the substitution could be extracted successfully.