def _is_method_retryable(
        self,
        settings: Dict[str, Any],
        request: HTTPRequestType,
        response: Optional[AllHttpResponseType] = None,
    ):
        """Checks if a given HTTP method should be retried upon, depending if
        it is included on the method allowlist.

        :param dict settings: The retry settings.
        :param request: The HTTP request object.
        :type request: ~azure.core.rest.HttpRequest
        :param response: The HTTP response object.
        :type response: ~azure.core.rest.HttpResponse or ~azure.core.rest.AsyncHttpResponse
        :return: True if method should be retried upon. False if not in method allowlist.
        :rtype: bool
        """
        if response and request.method.upper() in ["POST", "PATCH"] and response.status_code in [500, 503, 504]:
            return True
        if request.method.upper() not in settings["methods"]:
            return False

        return True
Checks if a given HTTP method should be retried upon, depending if
        it is included on the method allowlist.

        :param dict settings: The retry settings.
        :param request: The HTTP request object.
        :type request: ~azure.core.rest.HttpRequest
        :param response: The HTTP response object.
        :type response: ~azure.core.rest.HttpResponse or ~azure.core.rest.AsyncHttpResponse
        :return: True if method should be retried upon. False if not in method allowlist.
        :rtype: bool
        
Solutions/CyberArkAudit/Data Connectors/.python_packages/lib/site-packages/azure/core/pipeline/policies/_retry.py