def METHOD_NAME(cls, df, logic):
    if isinstance(logic, dict):
        assert (len(logic) == 1)
        key = list(logic.keys())[0]
        values = logic[key]
        if key == 'and':
            retval = cls.METHOD_NAME(df, values[0])
            for value in values[1:]:
                retval &= cls.METHOD_NAME(df, value)
            return retval
        elif key == 'or':
            retval = cls.METHOD_NAME(df, values[0])
            for value in values[1:]:
                retval |= cls.METHOD_NAME(df, value)
            return retval
        elif key == 'not':
            return ~cls.METHOD_NAME(df, values)
    elif isinstance(logic, list):
        retval = cls.METHOD_NAME(df, logic[0])
        for value in logic[1:]:
            retval &= cls.METHOD_NAME(df, value)
        return retval
    elif isinstance(logic, str):
        key, value = logic.split('|')
        return df[key] == value