def expression(data, math_expr, metric="sum.inc"):
    """Find the graphframes with whose value satisfy the given expression

    Arguments:
        data (graphframe or list of graphframes): graphframes to be filtered

        math_expr (str): A space-delimited comparison operation expression using
            'x' for the variable, numerical values, and: < <= > >= && ||

        metric (str): the column in the dataframe to apply the expression to

    Return Value:
        graphframe or list of graphframe: data type will be the same as the input data

    Example:
        The following will filter out any rows whose sum.inc value is less than
        1,000 or greater than 100,000:

            filter(data, 'x > 1.0e3 && x < 1e6', "sum.inc")
    """

    def eval_math_expr(x):
        _expr = math_expr.replace("x", "{}".format(x[metric]))
        # print(f"Executing expression: '{_expr}'")
        _and = _expr.split("&&")
        for itr in _and:
            if "||" in itr:
                _or = itr.split("||")
                _n_or = 0
                for sitr in _or:
                    _n_or += 1 if eval(sitr) else 0
                if _n_or == 0:
                    # print(f'    Failure! {sitr}')
                    return False
            else:
                if not eval(itr):
                    # print(f'    Failure! {itr}')
                    return False
        # print(f'    Success: {_expr}')
        return True

    if math_expr is not None:
        # strictly validate that there is nothing in the expression that
        # is unexpected since `eval(...)` is dangerous to invoke trivially.
        math_split = math_expr.split()
        valid_filter = ("x", "<", "<=", ">", ">=", "&&", "||")
        for token in math_split:
            if token in valid_filter:
                continue
            else:
                try:
                    float(token)
                except ValueError:
                    raise ValueError(
                        "Error: Token '{}' is not valid. Must be numeric or one of: {}".format(
                            token, " ".join(valid_filter)
                        )
                    )
    else:
        raise ValueError("Error: Invalid math expression!")

    if not isinstance(data, list):
        return data.filter(eval_math_expr, num_procs=1)

    ret = []
    for itr in data:
        ret.append(itr.filter(eval_math_expr, num_procs=1))
    return ret