docs: def is_resource_modified(
      environ, etag=None, data=None, last_modified=None, ignore_if_range=True
  ):
      """Convenience method for conditional requests.
  
      :param environ: the WSGI environment of the request to be checked.
      :param etag: the etag for the response for comparison.
      :param data: or alternatively the data of the response to automatically
                   generate an etag using :func:`generate_etag`.
      :param last_modified: an optional date of the last modification.
      :param ignore_if_range: If `False`, `If-Range` header will be taken into
                              account.
      :return: `True` if the resource was modified, otherwise `False`.
      """
      if etag is None and data is not None:
          etag = generate_etag(data)
      elif data is not None:
          raise TypeError("both data and etag given")
      if environ["REQUEST_METHOD"] not in ("GET", "HEAD"):
          return False
  
      unmodified = False
      if isinstance(last_modified, string_types):
          last_modified = parse_date(last_modified)
  
      # ensure that microsecond is zero because the HTTP spec does not transmit
      # that either and we might have some false positives.  See issue #39
      if last_modified is not None:
          last_modified = last_modified.replace(microsecond=0)
  
      if_range = None
      if not ignore_if_range and "HTTP_RANGE" in environ:
          # https://tools.ietf.org/html/rfc7233#section-3.2
          # A server MUST ignore an If-Range header field received in a request
          # that does not contain a Range header field.
          if_range = parse_if_range_header(environ.get("HTTP_IF_RANGE"))
  
      if if_range is not None and if_range.date is not None:
          modified_since = if_range.date
      else:
          modified_since = parse_date(environ.get("HTTP_IF_MODIFIED_SINCE"))
  
      if modified_since and last_modified and last_modified <= modified_since:
          unmodified = True
  
      if etag:
          etag, _ = unquote_etag(etag)
          if if_range is not None and if_range.etag is not None:
              unmodified = parse_etags(if_range.etag).contains(etag)
          else:
              if_none_match = parse_etags(environ.get("HTTP_IF_NONE_MATCH"))
              if if_none_match:
                  # https://tools.ietf.org/html/rfc7232#section-3.2
                  # "A recipient MUST use the weak comparison function when comparing
                  # entity-tags for If-None-Match"
                  unmodified = if_none_match.contains_weak(etag)
  
              # https://tools.ietf.org/html/rfc7232#section-3.1
              # "Origin server MUST use the strong comparison function when
              # comparing entity-tags for If-Match"
              if_match = parse_etags(environ.get("HTTP_IF_MATCH"))
              if if_match:
                  unmodified = not if_match.is_strong(etag)
  
      return not unmodified