def _replace_register(flow_params, register_number, register_value):
 try:
  reg_port = flow_params[register_value]
  del flow_params[register_value]
  flow_params['reg{:d}'.format(register_number)] = reg_port
 except KeyError:
  pass

def _replace_register ( flow_params , register_number , register_value ) : try : reg_port = flow_params [ register_value ] del flow_params [ register_value ] flow_params [ 'reg{:d}' . format ( register_number ) ] = reg_port except KeyError : pass
replace value from flows to given register number register_value key in dictionary will be replaced by register number given by register_number .