<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def type_map_directive_reducer( map_: TypeMap, directive: GraphQLDirective = None ) -> TypeMap: """Reducer function for creating the type map from given directives."""

    # Directives are not validated until validate_schema() is called.
    if not is_directive(directive):
        return map_
    directive = cast(GraphQLDirective, directive)
    return reduce(
        lambda prev_map, arg: type_map_reducer(prev_map, arg.type),  # type: ignore
        directive.args.values(),
        map_,
    )