def match_path(rule, path):
split_rule = split_by_slash(rule)<EOL>split_path = split_by_slash(path)<EOL>url_vars = {}<EOL>if len(split_rule) != len(split_path):<EOL><INDENT>return False, {}<EOL><DEDENT>for r, p in zip(split_rule, split_path):<EOL><INDENT>if r.startswith('<STR_LIT:{>') and r.endswith('<STR_LIT:}>'):<EOL><INDENT>url_vars[r[<NUM_LIT:1>:-<NUM_LIT:1>]] = p<EOL>continue<EOL><DEDENT>if r != p:<EOL><INDENT>return False, {}<EOL><DEDENT><DEDENT>return True, url_vars<EOL>
Match path.

    >>> match_path('/foo', '/foo')
    (True, {})
    >>> match_path('/foo', '/bar')
    (False, {})
    >>> match_path('/users/{user_id}', '/users/1')
    (True, {'user_id': '1'})
    >>> match_path('/users/{user_id}', '/users/not-integer')
    (True, {'user_id': 'not-integer'})