def __call__(self, parser, namespace, values, option_string=None):
    parsed = urllib.parse.urlparse(values)
    if (parsed.netloc == ''):
        parsed = urllib.parse.urlparse(('http://' + values))
    if (parsed.scheme == ''):
        parsed = urllib.parse.urlparse(('http://' + values))
    if ((parsed.path != '') or (parsed.params != '') or (parsed.query != '') or (parsed.fragment != '')):
        raise ArgumentError(self, f'{values} is not an accepted hostname')
    if (not parsed.hostname):
        raise ArgumentError(self, f'{values} is not an accepted hostname')
    hostname_regex = re.compile(('^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*' + '([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$'))
    if (not hostname_regex.match(parsed.hostname)):
        try:
            ipaddress.ip_address(parsed.hostname)
        except ValueError as val_error:
            raise ArgumentError(self, f'{values} is not an accepted hostname') from val_error
    scheme = parsed.scheme
    port = None
    if (scheme in ['http', 'couchbase']):
        if (not parsed.port):
            port = 8091
        if (scheme == 'couchbase'):
            scheme = 'http'
    elif (scheme in ['https', 'couchbases']):
        if (not parsed.port):
            port = 18091
        if (scheme == 'couchbases'):
            scheme = 'https'
    else:
        raise ArgumentError(self, ('%s is not an accepted scheme' % scheme))
    if parsed.port:
        setattr(namespace, self.dest, ((scheme + '://') + parsed.netloc))
    else:
        setattr(namespace, self.dest, ((((scheme + '://') + parsed.netloc) + ':') + str(port)))
def __call__(self, parser, namespace, values, option_string=None):
    parsed = urllib.parse.urlparse(values)
    if (parsed.netloc == ):
        parsed = urllib.parse.urlparse(('http://' + values))
    if (parsed.scheme == ):
        parsed = urllib.parse.urlparse(('http://' + values))
    if ((parsed.path != ) or (parsed.params != ) or (parsed.query != ) or (parsed.fragment != )):
        raise ArgumentError(self, f'{values} is not an accepted hostname')
    if (not parsed.hostname):
        raise ArgumentError(self, f'{values} is not an accepted hostname')
    hostname_regex = re.compile(('^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*' + '([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$'))
    if (not hostname_regex.match(parsed.hostname)):
        try:
            ipaddress.ip_address(parsed.hostname)
        except ValueError as val_error:
            raise ArgumentError(self, f'{values} is not an accepted hostname') from val_error
    scheme = parsed.scheme
    port = None
    if (scheme in ['http', 'couchbase']):
        if (not parsed.port):
            port = 8091
        if (scheme == 'couchbase'):
            scheme = 'http'
    elif (scheme in ['https', 'couchbases']):
        if (not parsed.port):
            port = 18091
        if (scheme == 'couchbases'):
            scheme = 'https'
    else:
        raise ArgumentError(self, ('%s is not an accepted scheme' % scheme))
    if parsed.port:
        setattr(namespace, self.dest, ((scheme + '://') + parsed.netloc))
    else:
        setattr(namespace, self.dest, ((((scheme + '://') + parsed.netloc) + ':') + str(port)))