def copy_kwargs(kwargs):
 vi = sys.version_info
 if ((vi[0] == 2) and (vi[1] <= 6) and (vi[3] < 5)):
  copy_kwargs = {}
  for key in kwargs:
   copy_kwargs[key.encode('utf-8')] = kwargs[key]
 else:
  copy_kwargs = copy.copy(kwargs)
 return copy_kwargs

def copy_kwargs ( kwargs ) : vi = sys . version_info if ( ( vi [ 0 ] == 2 ) and ( vi [ 1 ] <= 6 ) and ( vi [ 3 ] < 5 ) ) : copy_kwargs = { } for key in kwargs : copy_kwargs [ key . encode ( 'utf-8' ) ] = kwargs [ key ] else : copy_kwargs = copy . copy ( kwargs ) return copy_kwargs
there is a bug in python versions < 2 .