code: def union_with_variable(self, variable: str, replacement: VariableReplacement) -> 'Substitution':
          
          new_subst = Substitution(self)
          new_subst.try_add_variable(variable, replacement)
          return new_subst
docs: Try to create a new substitution with the given variable added.
  
          See :meth:`try_add_variable` for a version of this method that modifies the substitution
          in place.
  
          Args:
              variable_name:
                  The name of the variable to add.
              replacement:
                  The substitution for the variable.
  
          Returns:
              The new substitution with the variable_name added or merged.
  
          Raises:
              ValueError:
                  if the variable cannot be merged because it conflicts with the existing
                  substitution for the variable.