Apply expectations conditionally in SLDP

hdu
New Contributor III

Hi folks, 

The following code runs as expected, and all three rules are validated. 

    @dp.view(name=f"v_validate_source_{table}")
    @dp.expect_all_or_drop({"201-Data row":"row_cnt > 0"})
    @dp.expect_all_or_drop({
        "101-One footer row" : "footer_cnt = 1",
        "102-Row count mismatch" : "footer_row_cnt = row_cnt"
    })
    def validateSourceFileView():
          return df

My question is how can I apply rule 201 check conditionally? Something like:

    if condition:
       @dp.expect_all_or_drop({"201-Data row":"row_cnt > 0"})
    @dp.expect_all_or_drop({
        "101-One footer row" : "footer_cnt = 1",
        "102-Row count mismatch" : "footer_row_cnt = row_cnt"
    })

Thank you for your help in advance.