def _undo_op(arg, string, strict=False):
    """
    Undo symbolic op if string is in str(op).

    Returns <arg> untouched if there was no symbolic op.

    Parameters
    ----------
    arg : any symbolic variable.
    string : str
        String that specifies op.
    strict : bool
        Whether to force op undo or not (default False).
    """

    if hasattr(arg.owner, 'op'):
        owner = arg.owner
        if string in str(owner.op):
            return owner.inputs[0]
        elif strict:
            raise ValueError(string + ' not found in op ' +
                             str(owner.op) + '.')
    elif strict:
        raise ValueError(string + ' op not found in variable ' +
                         str(arg) + '.')
    return arg