def _replaceIf(condition, alternative):
 def decorator(func):
  if (condition is True):
   call = alternative
  elif (condition is False):
   call = func
  else:
   raise ValueError('condition argument to _replaceIf requires a bool, not {}'.format(repr(condition)))
  @wraps(func)
  def wrapped(*args, **kwargs):
   return call(*args, **kwargs)
  return wrapped
 return decorator

def _replaceIf ( condition , alternative ) : def decorator ( func ) : if ( condition is True ) : call = alternative elif ( condition is False ) : call = func else : raise ValueError ( 'condition argument to _replaceIf requires a bool, not {}' . format ( repr ( condition ) ) ) @ wraps ( func ) def wrapped ( * args , ** kwargs ) : return call ( * args , ** kwargs ) return wrapped return decorator
if c{condition} .