def merge_kwargs(local_kwarg, default_kwarg):
 if (default_kwarg is None):
  return local_kwarg
 if isinstance(local_kwarg, str):
  return local_kwarg
 if (local_kwarg is None):
  return default_kwarg
 if (not hasattr(default_kwarg, 'items')):
  return local_kwarg
 default_kwarg = from_key_val_list(default_kwarg)
 local_kwarg = from_key_val_list(local_kwarg)
 def get_original_key(original_keys, new_key):
  '\n        Finds the key from original_keys that case-insensitive matches new_key.\n        '
  for original_key in original_keys:
   if (key.lower() == original_key.lower()):
    return original_key
  return new_key
 kwargs = default_kwarg.copy()
 original_keys = kwargs.keys()
 for (key, value) in local_kwarg.items():
  kwargs[get_original_key(original_keys, key)] = value
 for (k, v) in local_kwarg.items():
  if (v is None):
   del kwargs[k]
 return kwargs

def merge_kwargs ( local_kwarg , default_kwarg ) : if ( default_kwarg is None ) : return local_kwarg if isinstance ( local_kwarg , str ) : return local_kwarg if ( local_kwarg is None ) : return default_kwarg if ( not hasattr ( default_kwarg , 'items' ) ) : return local_kwarg default_kwarg = from_key_val_list ( default_kwarg ) local_kwarg = from_key_val_list ( local_kwarg ) def get_original_key ( original_keys , new_key ) : for original_key in original_keys : if ( key . lower ( ) == original_key . lower ( ) ) : return original_key return new_key kwargs = default_kwarg . copy ( ) original_keys = kwargs . keys ( ) for ( key , value ) in local_kwarg . items ( ) : kwargs [ get_original_key ( original_keys , key ) ] = value for ( k , v ) in local_kwarg . items ( ) : if ( v is None ) : del kwargs [ k ] return kwargs
merges kwarg dictionaries .