def normalize_props(props):
 if (not isinstance(props, dict)):
  props = dict.fromkeys(props)
 props = dict(((key, (value if isinstance(value, basestring) else (('{%s}' % key) if (value is None) else str(value)))) for (key, value) in props.iteritems()))
 return props

def normalize_props ( props ) : if ( not isinstance ( props , dict ) ) : props = dict . fromkeys ( props ) props = dict ( ( ( key , ( value if isinstance ( value , basestring ) else ( ( '{%s}' % key ) if ( value is None ) else str ( value ) ) ) ) for ( key , value ) in props . iteritems ( ) ) ) return props
returns a normalized property list/dict so that : - a list gives {k: "{k}"} - a dict gives {k: v if v is not none else "{%s}" % v} .