code: def image_path(instance, filename):
      
      filename, ext = os.path.splitext(filename.lower())
      instance_id_hash = hashlib.md5(str(instance.id)).hexdigest()
      filename_hash = ''.join(random.sample(hashlib.md5(filename.encode('utf-8')).hexdigest(), 8))
      return '{}/{}{}'.format(instance_id_hash, filename_hash, ext)
docs: Generates likely unique image path using md5 hashes