def _check_rules_list(rules_list):
    def fail():
        msg = "rules_list is not in the correct format. Please use build_rule to build your rules list."
        raise RulesListFormatException(msg)

    if not isinstance(rules_list, list):
        fail()

    expected = ("value", "tag")
    for r in rules_list:
        if not isinstance(r, dict):
            fail()

        if "value" not in r:
            fail()

        if not isinstance(r['value'], basestring):
            fail()

        if "tag" in r and not isinstance(r['tag'], basestring):
            fail()

        for k in r:
            if k not in expected:
                fail()
Checks a rules_list to ensure that all rules are in the correct format.
dataset/ETHPy150Open twitterdev/twitter-for-bigquery/libs/gnippy/rules.py/_check_rules_list