def list_to_local(acs, attrlist, allow_unknown_attributes=False):
 if (not acs):
  acs = [AttributeConverter()]
  acsd = {'': acs}
 else:
  acsd = dict([(a.name_format, a) for a in acs])
 ava = {}
 for attr in attrlist:
  try:
   _func = acsd[attr.name_format].ava_from
  except KeyError:
   if ((attr.name_format == NAME_FORMAT_UNSPECIFIED) or allow_unknown_attributes):
    _func = acs[0].lcd_ava_from
   else:
    logger.info(('Unsupported attribute name format: %s' % (attr.name_format,)))
    continue
  try:
   (key, val) = _func(attr)
  except KeyError:
   if allow_unknown_attributes:
    (key, val) = acs[0].lcd_ava_from(attr)
   else:
    logger.info(('Unknown attribute name: %s' % (attr,)))
    continue
  except AttributeError:
   continue
  try:
   ava[key].extend(val)
  except KeyError:
   ava[key] = val
 return ava

def list_to_local ( acs , attrlist , allow_unknown_attributes = False ) : if ( not acs ) : acs = [ AttributeConverter ( ) ] acsd = { '' : acs } else : acsd = dict ( [ ( a . name_format , a ) for a in acs ] ) ava = { } for attr in attrlist : try : _func = acsd [ attr . name_format ] . ava_from except KeyError : if ( ( attr . name_format == NAME_FORMAT_UNSPECIFIED ) or allow_unknown_attributes ) : _func = acs [ 0 ] . lcd_ava_from else : logger . info ( ( 'Unsupported attribute name format: %s' % ( attr . name_format , ) ) ) continue try : ( key , val ) = _func ( attr ) except KeyError : if allow_unknown_attributes : ( key , val ) = acs [ 0 ] . lcd_ava_from ( attr ) else : logger . info ( ( 'Unknown attribute name: %s' % ( attr , ) ) ) continue except AttributeError : continue try : ava [ key ] . extend ( val ) except KeyError : ava [ key ] = val return ava
replaces the attribute names in a attribute value assertion with the equivalent name from a local name format .