code: def validate(tmpl, path):
      
      pattern = _generate_pattern_for_template(tmpl) + "$"
      return True if re.match(pattern, path) is not None else False
docs: Validate a path against the path template.
  
      .. code-block:: python
  
          >>> validate('users/*/messages/*', 'users/me/messages/123')
          True
          >>> validate('users/*/messages/*', 'users/me/drafts/123')
          False
          >>> validate('/v1/{name=shelves/*/books/*}', /v1/shelves/1/books/3)
          True
          >>> validate('/v1/{name=shelves/*/books/*}', /v1/shelves/1/tapes/3)
          False
  
      Args:
          tmpl (str): The path template.
          path (str): The expanded path.
  
      Returns:
          bool: True if the path matches.