def stringify_dict(dct_or_tuples, encoding='utf-8', keys_only=True):
 d = {}
 for (k, v) in dict(dct_or_tuples).iteritems():
  k = (k.encode(encoding) if isinstance(k, unicode) else k)
  if (not keys_only):
   v = (v.encode(encoding) if isinstance(v, unicode) else v)
  d[k] = v
 return d

def stringify_dict ( dct_or_tuples , encoding = 'utf-8' , keys_only = True ) : d = { } for ( k , v ) in dict ( dct_or_tuples ) . iteritems ( ) : k = ( k . encode ( encoding ) if isinstance ( k , unicode ) else k ) if ( not keys_only ) : v = ( v . encode ( encoding ) if isinstance ( v , unicode ) else v ) d [ k ] = v return d
return a dict with the unicode keys of the given dict converted to strings .