def subdomain_based_buckets(self, request):
    if S3_IGNORE_SUBDOMAIN_BUCKETNAME:
        return False
    host = request.headers.get('host', request.headers.get('Host'))
    if (not host):
        host = urlparse(request.url).netloc
    if ((not host) or host.startswith('localhost') or host.startswith('localstack') or re.match('^[^.]+$', host) or re.match('^.*\\.svc\\.cluster\\.local:?\\d*$', host)):
        return False
    match = re.match('^([^\\[\\]:]+)(:\\d+)?$', host)
    if match:
        match = re.match('((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.|$)){4}', match.groups()[0])
        if match:
            return False
    match = re.match('^\\[(.+)\\](:\\d+)?$', host)
    if match:
        match = re.match('^(((?=.*(::))(?!.*\\3.+\\3))\\3?|[\\dA-F]{1,4}:)([\\dA-F]{1,4}(\\3|:\\b)|\\2){5}(([\\dA-F]{1,4}(\\3|:\\b|$)|\\2){2}|(((2[0-4]|1\\d|[1-9])?\\d|25[0-5])\\.?\\b){4})\\Z', match.groups()[0], re.IGNORECASE)
        if match:
            return False
    path_based = ((host == 's3.amazonaws.com') or re.match('s3[\\.\\-]([^.]*)\\.amazonaws\\.com', host))
    return (not path_based)
def subdomain_based_buckets(self, request):
    if S3_IGNORE_SUBDOMAIN_BUCKETNAME:
        return False
    host = request.headers.get('host', request.headers.get('Host'))
    if (not host):
        host = urlparse(request.url).netloc
    if ((not host) or host.startswith('localhost') or host.startswith('localstack') or re.match('^[^.]+$', host) or re.match('^.*\\.svc\\.cluster\\.local:?\\d*$', host)):
        return False
    match = re.match('^([^\\[\\]:]+)(:\\d+)?$', host)
    if match:
        match = re.match('((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.|$)){4}', match.groups()[0])
        if match:
            return False
    match = re.match('^\\[(.+)\\](:\\d+)?$', host)
    if match:
        match = re.match('^(((?=.*(::))(?!.*\\3.+\\3))\\3?|[\\dA-F]{1,4}:)([\\dA-F]{1,4}(\\3|:\\b)|\\2){5}(([\\dA-F]{1,4}(\\3|:\\b|$)|\\2){2}|(((2[0-4]|1\\d|[1-9])?\\d|25[0-5])\\.?\\b){4})\\Z', match.groups()[0], re.IGNORECASE)
        if match:
            return False
    path_based = ((host == 's3.amazonaws.com') or re.match('s3[\\.\\-]([^.]*)\\.amazonaws\\.com', host))
    return (not path_based)