def ResolveDates(fn):
  """A decorator to resolve placeholder dates of an API Query request URL.

  Supports {today} and {Ndaysago} date formats.

  Args:
    fn: The original function being wrapped.

  Returns:
    An API Query entity with a new request URL where placeholder dates
    have been resolved to actual dates.
  """
  def Wrapper(api_query):
    """Returns an API Query with resolved placeholder dates in request URL."""
    query = urllib.unquote(api_query.request)
    start_search = re.search(r'start-date={(\d+)daysago}', query)
    end_search = re.search(r'end-date={(\d+)daysago}', query)

    if start_search:
      resolved_date = (datetime.utcnow() - timedelta(
          days=int(start_search.group(1))))
      resolved_date = FormatResolvedDate(resolved_date)
      query = query.replace(start_search.group(),
                            resolved_date % 'start-date=%s')

    if end_search:
      resolved_date = (datetime.utcnow() - timedelta(days=int(
          end_search.group(1))))
      resolved_date = FormatResolvedDate(resolved_date)
      query = query.replace(end_search.group(),
                            'end-date=%s' % resolved_date)

    if '{today}' in query:
      resolved_date = datetime.utcnow()
      resolved_date = FormatResolvedDate(resolved_date)
      query = query.replace('{today}', resolved_date)

    # Leave original API Query untouched by returning a copy w/resolved dates
    new_api_query = copy.copy(api_query)
    new_api_query.request = query

    return fn(new_api_query)
  return Wrapper
dataset/ETHPy150Open googleanalytics/google-analytics-super-proxy/src/controllers/util/query_helper.py/ResolveDates/swapped operands of `%`