def parse_search_values_from_opts(opts):
 search_values = {}
 for key in ('id', 'region', 'zone', 'ip', 'port', 'replication_ip', 'replication_port', 'device', 'weight', 'meta'):
  value = getattr(opts, key, None)
  if value:
   if ((key == 'ip') or (key == 'replication_ip')):
    value = validate_and_normalize_address(value)
  search_values[key] = value
 return search_values

def parse_search_values_from_opts ( opts ) : search_values = { } for key in ( 'id' , 'region' , 'zone' , 'ip' , 'port' , 'replication_ip' , 'replication_port' , 'device' , 'weight' , 'meta' ) : value = getattr ( opts , key , None ) if value : if ( ( key == 'ip' ) or ( key == 'replication_ip' ) ) : value = validate_and_normalize_address ( value ) search_values [ key ] = value return search_values
convert optparse style options into a dictionary for searching .