def _cast_inplace(terms, acceptable_dtypes, dtype):
dt = np.dtype(dtype)<EOL>for term in terms:<EOL><INDENT>if term.type in acceptable_dtypes:<EOL><INDENT>continue<EOL><DEDENT>try:<EOL><INDENT>new_value = term.value.astype(dt)<EOL><DEDENT>except AttributeError:<EOL><INDENT>new_value = dt.type(term.value)<EOL><DEDENT>term.update(new_value)<EOL><DEDENT>
Cast an expression inplace.

    Parameters
    ----------
    terms : Op
        The expression that should cast.
    acceptable_dtypes : list of acceptable numpy.dtype
        Will not cast if term's dtype in this list.

        .. versionadded:: 0.19.0

    dtype : str or numpy.dtype
        The dtype to cast to.