def args_to_params(payload: dict, passed_arguments: dict, endpoints: list, epname: str) -> dict:
    """This function reviews arguments passed to the function against arguments accepted by the endpoint.
       If a valid argument is passed, it is added and returned as part of the payload dictionary.

       This function will convert passed comma-delimited strings to list data types when necessary.
    """
    for arg in passed_arguments:
        eps = [ep[5] for ep in endpoints if epname in ep[0]][0]
        try:
            argument = [param for param in eps if param["name"] == arg][0]
            if argument:
                arg_name = argument["name"]
                if argument["type"] == "array":
                    if isinstance(passed_arguments[arg_name], (str)):
                        passed_arguments[arg_name] = passed_arguments[arg_name].split(",")
                # More data type validation can go here
                payload[arg_name] = passed_arguments[arg_name]
        except IndexError:
            # Unrecognized argument
            pass

    return payload