@with_default()
def _case_insensitive_lookup(entries, key, default=UNDEFINED):
 if (entries is not None):
  if isinstance(entries, dict):
   for (k, v) in list(entries.items()):
    if (k.lower() == key.lower()):
     return v
  else:
   for entry in entries:
    if (entry.lower() == key.lower()):
     return entry
 raise ValueError(("key '%s' doesn't exist in dict: %s" % (key, entries)))

@ with_default ( ) def _case_insensitive_lookup ( entries , key , default = UNDEFINED ) : if ( entries is not None ) : if isinstance ( entries , dict ) : for ( k , v ) in list ( entries . items ( ) ) : if ( k . lower ( ) == key . lower ( ) ) : return v else : for entry in entries : if ( entry . lower ( ) == key . lower ( ) ) : return entry raise ValueError ( ( "key '%s' doesn't exist in dict: %s" % ( key , entries ) ) )
makes a case insensitive lookup within a list or dictionary .