<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def filter_args_to_dict(filter_dict, accepted_filter_keys=[]):
 """Cast and validate filter args. :param filter_dict: Filter kwargs :param accepted_filter_keys: List of keys that are acceptable to use. """

    out_dict = {}
    for k, v in filter_dict.items():
        # make sure that the filter k is acceptable
        # and that there is a value associated with the key
        if k not in accepted_filter_keys or v is None:
            logger.debug(
                'Filter was not in accepted_filter_keys or value is None.')
            # skip it
            continue
        filter_type = filter_type_map.get(k, None)

        if filter_type is None:
            logger.debug('Filter key not foud in map.')
            # hmm, this was an acceptable filter type but not in the map...
            # Going to skip it.
            continue

        # map of casting funcitons to filter types
        filter_cast_map = {
            'int': cast_integer_filter,
            'datetime': cast_datetime_filter
        }
        cast_function = filter_cast_map.get(filter_type, None)

        # if we get a cast function, call it with v. If not, just use v.
        if cast_function:
            out_value = cast_function(v)
        else:
            out_value = v
        out_dict[k] = out_value

    return out_dict