code: def is_resource_modified(environ, etag=None, data=None, last_modified=None):
      
      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)
  
      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:
          if_none_match = parse_etags(environ.get('HTTP_IF_NONE_MATCH'))
          if if_none_match:
              unmodified = if_none_match.contains_raw(etag)
  
      return not unmodified
docs: 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.
      :return: `True` if the resource was modified, otherwise `False`.