def _build_arguments(keyword_args):
    """
    Builds a dictionary of function arguments appropriate to the index to be computed.

    :param dict keyword_args:
    :return: dictionary of arguments keyed with names expected by the corresponding
        index computation function
    """

    function_arguments = {"data_start_year": keyword_args["data_start_year"]}

    if keyword_args["index"] in ["spi", "spei"]:
        function_arguments["scale"] = keyword_args["scale"]
        function_arguments["distribution"] = keyword_args["distribution"]
        function_arguments["calibration_year_initial"] = \
            keyword_args["calibration_start_year"]
        function_arguments["calibration_year_final"] = \
            keyword_args["calibration_end_year"]
        function_arguments["periodicity"] = keyword_args["periodicity"]

    elif keyword_args["index"] == "pnp":
        function_arguments["scale"] = keyword_args["scale"]
        function_arguments["calibration_start_year"] = \
            keyword_args["calibration_start_year"]
        function_arguments["calibration_end_year"] = \
            keyword_args["calibration_end_year"]
        function_arguments["periodicity"] = keyword_args["periodicity"]

    elif keyword_args["index"] == "palmers":
        function_arguments["calibration_start_year"] = \
            keyword_args["calibration_start_year"]
        function_arguments["calibration_end_year"] = \
            keyword_args["calibration_end_year"]

    elif keyword_args["index"] != "pet":
        raise ValueError(
            "Index {index} not yet supported.".format(index=keyword_args["index"])
        )

    return function_arguments