import ast


def get_call_kwargs(node):
    """
    Get the kwargs name from Call node.
    """
    keywords = node.keywords
    if len(keywords) == 0:
        return None

    # dunno if we can get more than one dict unpack in python 3.5
    # check anyways
    kwargs_count = sum(map(lambda obj: obj.arg is None, keywords))
    if kwargs_count > 1:
        raise NotImplementedError("Currently only supports one kwargs")

    last = keywords[-1]
    # keywords have arg = None
    if last.arg is not None:
        return None

    if not isinstance(last.value, ast.Name):
        raise ValueError("Only support starargs that unpack a variable")

    return last.value.id