def get_required_kwonly_args(argspecs):
    """Determines whether given argspecs implies required keywords-only args
    and returns them as a list. Returns empty list if no such args exist.
    """
    try:
        kwonly = argspecs.kwonlyargs
        if argspecs.kwonlydefaults is None:
            return kwonly
        res = []
        for name in kwonly:
            if not name in argspecs.kwonlydefaults:
                res.append(name)
        return res
    except AttributeError:
        return []