def add_rule(self, **args):
<EOL>myrule = {<EOL>"<STR_LIT:source>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT:*>",<EOL>"<STR_LIT>": "<STR_LIT:*>",<EOL>"<STR_LIT>": <NUM_LIT:0.0>,<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": <NUM_LIT:0.0>,<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": <NUM_LIT:0.0>,<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": -<NUM_LIT:1>,<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>"<EOL>}<EOL>rule = args.copy()<EOL>for i in list(rule.keys()):<EOL><INDENT>if i not in myrule:<EOL><INDENT>continue<EOL><DEDENT>myrule[i] = rule[i]<EOL><DEDENT>services = self.app.get_services()<EOL>assert myrule["<STR_LIT:source>"] != "<STR_LIT>" and myrule["<STR_LIT>"] != "<STR_LIT>"<EOL>assert myrule["<STR_LIT:source>"] in services and myrule["<STR_LIT>"] in services<EOL>assert myrule['<STR_LIT>'] != "<STR_LIT>" or myrule["<STR_LIT>"] != "<STR_LIT>"<EOL>assert myrule['<STR_LIT>'] ><NUM_LIT:0.0> or myrule['<STR_LIT>'] ><NUM_LIT:0.0> or myrule['<STR_LIT>'] ><NUM_LIT:0.0><EOL>if myrule["<STR_LIT>"] > <NUM_LIT:0.0>:<EOL><INDENT>assert myrule["<STR_LIT>"] != "<STR_LIT>"<EOL><DEDENT>if myrule["<STR_LIT>"] > <NUM_LIT:0.0>:<EOL><INDENT>assert myrule["<STR_LIT>"] >= -<NUM_LIT:1><EOL><DEDENT>assert myrule["<STR_LIT>"] in ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]<EOL>self._queue.append(myrule)<EOL>
@param args keyword argument list, consisting of:

source: <source service name>,
dest: <destination service name>,
messagetype: <request|response|publish|subscribe|stream>

headerpattern: <regex to match against the value of the X-Gremlin-ID trackingheader present in HTTP headers>
bodypattern: <regex to match against HTTP message body>

delayprobability: <float, 0.0 to 1.0>
delaydistribution: <uniform|exponential|normal> probability distribution function
mangleprobability: <float, 0.0 to 1.0>
mangledistribution: <uniform|exponential|normal> probability distribution function

abortprobability: <float, 0.0 to 1.0>
abortdistribution: <uniform|exponential|normal> probability distribution function

delaytime: <string> latency to inject into requests <string, e.g., "10ms", "1s", "5m", "3h", "1s500ms">
errorcode: <Number> HTTP error code or -1 to reset TCP connection
searchstring: <string> string to replace when Mangle is enabled
replacestring: <string> string to replace with for Mangle fault