<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse(url, defaultPort=True):
 """ Split the given URL into the scheme, host, port, and path. @type url: C{str} @param url: An URL to parse. @type defaultPort: C{bool} @param defaultPort: Whether to return the default port associated with the scheme in the given url, when the url doesn't specify one. @return: A four-tuple of the scheme, host, port, and path of the URL. All of these are C{str} instances except for port, which is an C{int}. """

    url = url.strip()
    parsed = urlparse(url)
    scheme = parsed[0]
    path = urlunparse(("", "") + parsed[2:])
    host = parsed[1]

    if ":" in host:
        host, port = host.split(":")
        try:
            port = int(port)
        except ValueError:
            # A non-numeric port was given, it will be replaced with
            # an appropriate default value if defaultPort is True
            port = None
    else:
            port = None

    if port is None and defaultPort:
        if scheme == "https":
            port = 443
        else:
            port = 80

    if path == "":
        path = "/"
    return (str(scheme), str(host), port, str(path))