def _warn_keyword_parameter(func_name, kwargs):
    """
    Backwards-compatibility with Python 2.7 to allow treating 'warn' as keyword-only.
    """
    if not kwargs:
        return False
    elif len(kwargs) > 1 or 'warn' not in kwargs:
        kwargs.pop('warn', None)
        arg = next(iter(kwargs.keys()))
        raise TypeError('{}() got an unexpected keyword argument {!r}'.
            format(func_name, arg))
    return kwargs['warn']
