def match_url_vars_type(url_vars, type_hints):
typed_url_vars = {}<EOL>try:<EOL><INDENT>for k, v in url_vars.items():<EOL><INDENT>arg_type = type_hints.get(k)<EOL>if arg_type and arg_type != str:<EOL><INDENT>typed_url_vars[k] = arg_type(v)<EOL><DEDENT>else:<EOL><INDENT>typed_url_vars[k] = v<EOL><DEDENT><DEDENT><DEDENT>except ValueError:<EOL><INDENT>return False, {}<EOL><DEDENT>return True, typed_url_vars<EOL>
Match types of url vars.

    >>> match_url_vars_type({'user_id': '1'}, {'user_id': int})
    (True, {'user_id': 1})
    >>> match_url_vars_type({'user_id': 'foo'}, {'user_id': int})
    (False, {})