Merge metadata list (add all missing tuples)

def _merge_options_metadata(options, settings):
    """Merge metadata list (add all missing tuples)"""
    if not options:
        return options
    kwargs = options.kwargs
    if kwargs == gax.OPTION_INHERIT or 'metadata' not in kwargs:
        return options

    kwarg_meta_dict = {}
    merged_kwargs = options.kwargs.copy()
    for kwarg_meta in merged_kwargs['metadata']:
        kwarg_meta_dict[kwarg_meta[0].lower()] = kwarg_meta
    for kwarg_meta in settings.kwargs['metadata']:
        if kwarg_meta[0].lower() not in kwarg_meta_dict:
            merged_kwargs['metadata'].append(kwarg_meta)
    return gax.CallOptions(
        timeout=options.timeout, retry=options.retry,
        page_token=options.page_token,
        is_bundling=options.is_bundling,
        **merged_kwargs)