def sanitize_prefix(function):
 @functools.wraps(function)
 def wrapper(*args, **kwargs):
  args = list(args)
  offset = 1
  if ('prefix' in kwargs):
   kwargs['prefix'] = name_or_value(kwargs['prefix'])
  elif ((len(args) - 1) >= offset):
   args[offset] = name_or_value(args[offset])
   offset += 1
  if ('key' in kwargs):
   kwargs['key'] = name_or_value(kwargs['key'])
  elif ((len(args) - 1) >= offset):
   args[offset] = name_or_value(args[offset])
  return function(*tuple(args), **kwargs)
 return wrapper

def sanitize_prefix ( function ) : @ functools . wraps ( function ) def wrapper ( * args , ** kwargs ) : args = list ( args ) offset = 1 if ( 'prefix' in kwargs ) : kwargs [ 'prefix' ] = name_or_value ( kwargs [ 'prefix' ] ) elif ( ( len ( args ) - 1 ) >= offset ) : args [ offset ] = name_or_value ( args [ offset ] ) offset += 1 if ( 'key' in kwargs ) : kwargs [ 'key' ] = name_or_value ( kwargs [ 'key' ] ) elif ( ( len ( args ) - 1 ) >= offset ) : args [ offset ] = name_or_value ( args [ offset ] ) return function ( * tuple ( args ) , ** kwargs ) return wrapper
automatically call name_or_value on the prefix passed in .