code: def url_for(endpoint, **kw):
      
  
      _endpoint = None
      if isinstance(endpoint, six.string_types):
          return f_url_for(endpoint, **kw)
      else:
          # self, will refer the caller method, by getting the method name
          if isinstance(endpoint, Mocha):
              fn = sys._getframe().f_back.f_code.co_name
              endpoint = getattr(endpoint, fn)
  
          if is_method(endpoint):
              _endpoint = _get_action_endpoint(endpoint)
              if not _endpoint:
                  _endpoint = _build_endpoint_route_name(endpoint)
      if _endpoint:
          return f_url_for(_endpoint, **kw)
      else:
          raise exceptions.MochaError('Mocha `url_for` received an invalid endpoint')
docs: Mocha url_for is an alias to the flask url_for, with the ability of
      passing the function signature to build the url, without knowing the endpoint
      :param endpoint:
      :param kw:
      :return: