def _flatten_metadata(metadata):
 if metadata:
  return dict(((k, unicode(v)) for (k, v) in metadata.iteritems() if (type(v) not in set([list, dict, set]))))
 return {}

def _flatten_metadata ( metadata ) : if metadata : return dict ( ( ( k , unicode ( v ) ) for ( k , v ) in metadata . iteritems ( ) if ( type ( v ) not in set ( [ list , dict , set ] ) ) ) ) return { }
return flattened resource metadata without nested structures and with all values converted to unicode strings .