'Set etag attribute by generating hex MD5 checksum on current
contents of mock key.'

def set_etag(self):

    m = md5()
    if (not isinstance(self.data, bytes)):
        m.update(self.data.encode('utf-8'))
    else:
        m.update(self.data)
    hex_md5 = m.hexdigest()
    self.etag = hex_md5
