def substitute(self, mapping):
expr = self.__class__()<EOL>for var, value in iteritems(self._variables):<EOL><INDENT>expr += value * var.substitute(mapping)<EOL><DEDENT>return (expr + self._offset).simplify()<EOL>
Return expression with variables substituted

        >>> Expression('x + 2y').substitute(
        ...     lambda v: {'y': -3}.get(v.symbol, v))
        Expression('x - 6')
        >>> Expression('x + 2y').substitute(
        ...     lambda v: {'y': Variable('z')}.get(v.symbol, v))
        Expression('x + 2z')