def enforce_service_mode(services, FetcherClass, kwargs, modes):
fast_level = modes.get('<STR_LIT>', <NUM_LIT:0>)<EOL>average_level = modes.get('<STR_LIT>', <NUM_LIT:0>)<EOL>paranoid_level = modes.get('<STR_LIT>', <NUM_LIT:0>)<EOL>private_level = modes.get('<STR_LIT>', <NUM_LIT:0>)<EOL>verbose = modes.get('<STR_LIT>', False)<EOL>timeout = modes.get('<STR_LIT>', None)<EOL>if len(services) == <NUM_LIT:0>:<EOL><INDENT>raise NoService("<STR_LIT>")<EOL><DEDENT>if modes.get('<STR_LIT>', False):<EOL><INDENT>random.shuffle(services)<EOL><DEDENT>if private_level  > <NUM_LIT:0>:<EOL><INDENT>results = _do_private_mode(<EOL>FetcherClass, services, kwargs, random_wait_seconds=private_level,<EOL>verbose=verbose, timeout=timeout<EOL>)<EOL>return results<EOL><DEDENT>elif average_level <= <NUM_LIT:1> and paranoid_level <= <NUM_LIT:1> and fast_level == <NUM_LIT:0>:<EOL><INDENT>fetcher = FetcherClass(services=services, verbose=verbose, timeout=timeout)<EOL>consensus_results = fetcher.action(**kwargs)<EOL>used_services = [fetcher._successful_service]<EOL><DEDENT>elif average_level > <NUM_LIT:1>:<EOL><INDENT>results = _get_results(<EOL>FetcherClass, services, kwargs, num_results=average_level, verbose=verbose, timeout=timeout<EOL>)<EOL>to_compare, used_services = _prepare_consensus(FetcherClass, results)<EOL>consensus_results = sum(to_compare) / len(to_compare)<EOL><DEDENT>elif paranoid_level > <NUM_LIT:1>:<EOL><INDENT>results = _get_results(<EOL>FetcherClass, services, kwargs, num_results=paranoid_level, verbose=verbose, timeout=timeout<EOL>)<EOL>to_compare, used_services = _prepare_consensus(FetcherClass, results)<EOL>if len(set(to_compare)) > <NUM_LIT:1>:<EOL><INDENT>full_results = zip(used_services, to_compare)<EOL>show_error = "<STR_LIT:U+002CU+0020>".join("<STR_LIT>" % (s.name, v) for s, v in full_results)<EOL>sd = ServiceDisagreement("<STR_LIT>" % show_error)<EOL>sd.network_results = {<EOL>service: result for service, result in full_results<EOL>}<EOL>raise sd<EOL><DEDENT>consensus_results = results[<NUM_LIT:0>][<NUM_LIT:1>]<EOL><DEDENT>elif fast_level >= <NUM_LIT:1>:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL>results = _get_results(<EOL>FetcherClass, services, kwargs, fast=fast_level, verbose=verbose<EOL>)<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>if modes.get('<STR_LIT>'):<EOL><INDENT>return used_services, consensus_results<EOL><DEDENT>else:<EOL><INDENT>return consensus_results<EOL><DEDENT>
Fetches the value according to the mode of execution desired.
`FetcherClass` must be a class that is subclassed from AutoFallbackFetcher.
`services` must be a list of Service classes.
`kwargs` is a list of arguments used to make the service call, usually
  something like {crypto: 'btc', address: '1HwY...'} or
  {crypto: 'ltc', fiat: 'rur'}, (depends on the what FetcherClass.action takes)

Modes can be:

     average = positive int. 1 by default. Takes average of n fetches.
     verbose = [True|False] False by default. Extra output.
     random = [True|False] False by default. Randomizes service order.
     paranoid = positive int. 1 by default. Redundant Fetching.
     fast = positive int. 0 by default. Return as soon as recieved first n results.