code: def validate_path_to_api_path(path, paths, basePath='', context=None, **kwargs):
      
      if context is None:
          context = {}
      try:
          api_path = match_path_to_api_path(
              path_definitions=paths,
              target_path=path,
              base_path=basePath,
              context=context,
          )
      except LookupError as err:
          raise ValidationError(str(err))
      except MultiplePathsFound as err:
          raise ValidationError(str(err))
  
      return api_path
docs: Given a path, find the api_path it matches.