code: def does_s3_object_exist(bucket_name, key, session=None):
      
      if session:
          s3_resource = session.resource('s3')
      else:
          s3_resource = boto3.resource('s3')
  
      try:
          s3_resource.Object(bucket_name, key).load()
      except ClientError as exc:
          if exc.response['Error']['Code'] == '404':
              return False
          raise
      return True
docs: Determine if object exists on s3.