<s> from functools import wraps <EOL> from jnpr . junos . jxml import normalize_xslt <EOL> def timeoutDecorator ( function ) : <EOL> @ wraps ( function ) <EOL> def wrapper ( * args , ** kwargs ) : <EOL> if '<STR_LIT>' in kwargs : <EOL> try : <EOL> dev = args [ <NUM_LIT:0> ] . dev <EOL> except : <EOL> dev = args [ <NUM_LIT:0> ] <EOL> restore_timeout = dev . timeout <EOL> dev . timeout = kwargs . pop ( '<STR_LIT>' , None ) <EOL> try : <EOL> result = function ( * args , ** kwargs ) <EOL> dev . timeout = restore_timeout <EOL> return result <EOL> except Exception : <EOL> dev . timeout = restore_timeout <EOL> raise <EOL> else : <EOL> try : <EOL> return function ( * args , ** kwargs ) <EOL> except Exception : <EOL> raise <EOL> return wrapper <EOL> def normalizeDecorator ( function ) : <EOL> @ wraps ( function ) <EOL> def wrapper ( * args , ** kwargs ) : <EOL> if '<STR_LIT>' in kwargs : <EOL> normalize = kwargs . pop ( '<STR_LIT>' , None ) <EOL> try : <EOL> dev = args [ <NUM_LIT:0> ] . dev <EOL> except : <EOL> dev = args [ <NUM_LIT:0> ] <EOL> if dev . _normalize != normalize : <EOL> restore_transform = dev . transform <EOL> if normalize is False : <EOL> try : <EOL> dev . transform = dev . _nc_transform <EOL> result = function ( * args , ** kwargs ) <EOL> dev . transform = restore_transform <EOL> return result <EOL> except Exception : <EOL> dev . transform = restore_transform <EOL> raise <EOL> else : <EOL> try : <EOL> dev . transform = dev . _norm_transform <EOL> result = function ( * args , ** kwargs ) <EOL> dev . transform = restore_transform <EOL> return result <EOL> except Exception : <EOL> dev . transform = restore_transform <EOL> raise <EOL> else : <EOL> try : <EOL> return function ( * args , ** kwargs ) <EOL> except Exception : <EOL> raise <EOL> else : <EOL> try : <EOL> return function ( * args , ** kwargs ) <EOL> except Exception : <EOL> raise <EOL> return wrapper </s>
