For the python3 version(if you are calculating rates for versions CMSSW_12_0_0 and above), follow the instructions in https://twiki.cern.ch/twiki/bin/viewauth/CMS/SteamRatesEdmWorkflow (contains all the details) and https://twiki.cern.ch/twiki/bin/view/CMS/SteamHLTRatesCalculation (Tutorial)