def parse(url):
    """Parse a URL.

    >>> parse('http://example.com/foo/')
    URL(scheme='http', ..., domain='example', tld='com', ..., path='/foo/', ...)
    """
    parts = split(url)
    if parts.scheme:
        username, password, host, port = split_netloc(parts.netloc)
        subdomain, domain, tld = split_host(host)
    else:
        username = password = subdomain = domain = tld = port = ''
    return URL(parts.scheme, username, password, subdomain, domain, tld,
               port, parts.path, parts.query, parts.fragment, url)
Parse a URL.

    >>> parse('http://example.com/foo/')
    URL(scheme='http', ..., domain='example', tld='com', ..., path='/foo/', ...)