def _parse_url(value):

    scheme_pattern = r'^(?P<scheme>(?:(?:https?)://))'
    domain_pattern = (
        r'(?P<hostname>(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.?)+'
        '(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)?|')  # domain,

    value_regex = re.match(
        scheme_pattern +  # http:// or https://
        r'(([^:])+(:[^:]+)?@){0,1}' +  # auth credentials
        domain_pattern +
        r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))'  # or ip
        r'(?P<port>(?::\d+))?'  # port
        r'(?P<path>(?:/?|[/?]\S+))$',  # resource path
        value, re.IGNORECASE)

    if value_regex is None:
        scheme_match = re.match(scheme_pattern, value, re.IGNORECASE)
        if scheme_match is None:
            msg = 'Please check url {!r}. Missing http(s)://'.format(value)
            raise DCOSException(msg)
        else:
            raise DCOSException(
                'Unable to parse {!r} as a url'.format(value))
    else:
        return value
Returns either a variable by itself or a non-boolean operation (such as
dataset/ETHPy150Open dcos/dcos-cli/dcos/jsonitem.py/_parse_url--crossover with--dataset/ETHPy150Open skorokithakis/django-annoying/annoying/templatetags/smart_if.py/IfParser.get_bool_var