def get_filtered_keys(key_list, payload):
    """
    Filter the payload for the given keylist and return the filtered dict
    :param key_list: comma seperated keys in string format
    :param payload: dict payload which needs to be filtered
    :return: dict with key, value pair based on the keylist
    """

    ret_dict = dict()
    key_list = str(key_list).split(",")

    for key in key_list:
        value = payload.get(key)
        if not value:
            raise KeyError("Key: {} not present in payload: {} for keylist: {}"
                           .format(key, payload, key_list))
        ret_dict[key] = value
    return ret_dict