code: def datastream_etag(request, pid, dsid, repo=None,
      as_of_date=None, **kwargs):
      '''Method suitable for use as an etag function with
      :class:`django.views.decorators.http.condition`.  Takes the same
      arguments as :meth:`~eulfedora.views.raw_datastream`.
      '''
      # if a range is requested and it is not for the entire file,
      # do *NOT* return an etag
  
      # NOTE: using api directly here instead of object/ds models
      # to avoid making unneeded api calls
  
      try:
          if repo is None:
              repo = Repository()
          resp = repo.api.getDatastream(pid, dsid, asOfDateTime=as_of_date)
          dsprofile = parse_xml_object(DatastreamProfile, resp.content, resp.url)
          if dsprofile and dsprofile.checksum_type != 'DISABLED':
              return dsprofile.checksum
      except RequestFailed:
          pass
  
      return Nonf datastream_etag(request, pid, dsid, repo=None,
      as_of_date=None, **kwargs):
      '''Method suitable for use as an etag function with
      :class:`django.views.decorators.http.condition`.  Takes the same
      arguments as :meth:`~eulfedora.views.raw_datastream`.
      '''
      # if a range is requested and it is not for the entire file,
      # do *NOT* return an etag
  
      # NOTE: using api directly here instead of object/ds models
      # to avoid making unneeded api calls
  
      try:
          if repo is None:
              repo = Repository()
          resp = repo.api.getDatastream(pid, dsid, asOfDateTime=as_of_date)
          dsprofile = parse_xml_object(DatastreamProfile, resp.content, resp.url)
          if dsprofile and dsprofile.checksum_type != 'DISABLED':
              return dsprofile.checksum
      except RequestFailed:
          pass
  
      return None
docs: Method suitable for use as an etag function with
      :class:`django.views.decorators.http.condition`.  Takes the same
      arguments as :meth:`~eulfedora.views.raw_datastream`.