code: def ShouldRetry(self, exception):
          
          if not self.connection_policy.EnableEndpointDiscovery:
              return False
  
          if self.failover_retry_count >= self.Max_retry_attempt_count:
              return False
  
          self.failover_retry_count += 1
  
          if self.location_endpoint:
              if _OperationType.IsReadOnlyOperation(self.request.operation_type):
                  #Mark current read endpoint as unavailable
                  self.global_endpoint_manager.mark_endpoint_unavailable_for_read(self.location_endpoint)
              else:
                  self.global_endpoint_manager.mark_endpoint_unavailable_for_write(self.location_endpoint)
  
          # set the refresh_needed flag to ensure that endpoint list is
          # refreshed with new writable and readable locations
          self.global_endpoint_manager.refresh_needed = True
          
          # clear previous location-based routing directive
          self.request.clear_route_to_location()
  
          # set location-based routing directive based on retry count
          # simulating single master writes by ensuring usePreferredLocations
          # is set to false
          self.request.route_to_location_with_preferred_location_flag(self.failover_retry_count, False)
          
          # Resolve the endpoint for the request and pin the resolution to the resolved endpoint
          # This enables marking the endpoint unavailability on endpoint failover/unreachability
          self.location_endpoint = self.global_endpoint_manager.resolve_service_endpoint(self.request)
          self.request.route_to_location(self.location_endpoint)
          return True
docs: Returns true if should retry based on the passed-in exception.
  
          :param (errors.HTTPFailure instance) exception: 
  
          :rtype:
              boolean