def raise_for_unexpected_kwargs(method_name, arguments, sig_args,
    sig_kwargs, is_iterable):
    """Raise TypeError if arguments are not in sig_args or sig_kwargs."""
    expected = set(sig_args) | set(sig_kwargs)
    if is_iterable:
        expected |= {'iterator'}
    unexpected = set(arguments.keys()) - expected
    if unexpected:
        msg_fmt = '{}() got an unexpected keyword argument(s) {}'
        raise TypeError(msg_fmt.format(method_name, str(unexpected)))
